LoginSignup
2
1

More than 5 years have passed since last update.

Project Euler Q7 【10001番目の素数】

Last updated at Posted at 2017-10-02

Project Eulerをワンライナーで解いてみる。
間違っていたらコメントください。

問題

素数を小さい方から6つ並べると 2, 3, 5, 7, 11, 13 であり, 6番目の素数は 13 である.

10001 番目の素数を求めよ.

解答

seq 120000 |
factor |
awk 'NF==2' |
awk -F: 'NR==10001{print $1}'
104743

答え合わせ

こちらのサイト様と一致していればOKとした。
http://kingyojima.net/pje/007.html

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1