LoginSignup
1
1

More than 5 years have passed since last update.

Project Euler Q10 【素数の和】

Last updated at Posted at 2017-10-02

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

問題

10以下の素数の和は $2 + 3 + 5 + 7 = 17$ である.

200万以下の全ての素数の和を求めよ.

解答

seq 2000000 |
factor |
awk 'NF==2' |
awk '{a+=$2}END{print a}'
142913828922

答え合わせ

こちらのサイト様と一致していればOKとした。
Python で Project Euler #10「素数の和」

1
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
1
1