回答編集履歴
1
追記
answer
CHANGED
@@ -1,1 +1,11 @@
|
|
1
|
-
factorコマンドの[ドキュメント](https://www.gnu.org/software/coreutils/manual/html_node/factor-invocation.html)と[ソース](https://github.com/wertarbyte/coreutils/blob/master/src/factor.c)です。
|
1
|
+
factorコマンドの[ドキュメント](https://www.gnu.org/software/coreutils/manual/html_node/factor-invocation.html)と[ソース](https://github.com/wertarbyte/coreutils/blob/master/src/factor.c)です。
|
2
|
+
|
3
|
+
試しに200万までの素数の和を計算
|
4
|
+
```bash
|
5
|
+
$ time (seq 1 2000000|factor|awk '$0*=!$3{s+=$1}END{print s}')
|
6
|
+
142913828923
|
7
|
+
|
8
|
+
real 0m0.996s
|
9
|
+
user 0m1.459s
|
10
|
+
sys 0m0.071s
|
11
|
+
```
|