回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,21 @@
|
|
1
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
|
+
|
4
|
+
|
5
|
+
試しに200万までの素数の和を計算
|
6
|
+
|
7
|
+
```bash
|
8
|
+
|
9
|
+
$ time (seq 1 2000000|factor|awk '$0*=!$3{s+=$1}END{print s}')
|
10
|
+
|
11
|
+
142913828923
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
real 0m0.996s
|
16
|
+
|
17
|
+
user 0m1.459s
|
18
|
+
|
19
|
+
sys 0m0.071s
|
20
|
+
|
21
|
+
```
|