Skip to content

Instantly share code, notes, and snippets.

@papiron
Last active December 2, 2015 10:09
Show Gist options
  • Save papiron/32bd0546696c699f57a0 to your computer and use it in GitHub Desktop.
Save papiron/32bd0546696c699f57a0 to your computer and use it in GitHub Desktop.
シェル芸勉強会の前座的な手抜きの稚拙回答・・・
問題の元リンクはこちら
http://techlion.jp/archives/9691
ベタで力技で処理速度遅い回答はこちら・・・Macなのでfactorがgfactorになっちょります。
$ loopx <(seq 100 | gfactor | awk 'NF==2{print $2}') <(seq 100 | gfactor | awk 'NF==2{print $2}') | while read n1 n2; do [ $(echo $n1$n2 | gfactor | wc -w | tr -d " ") == 2 ] && echo $n1 $n2; done
2 3
2 11
2 23
2 29
2 41
2 71
2 83
3 7
3 11
3 13
3 17
3 31
3 37
3 47
3 53
3 59
3 67
3 73
3 79
3 83
3 89
3 97
5 3
5 23
5 41
5 47
5 71
7 3
7 19
7 43
7 61
7 73
7 97
11 3
11 17
11 23
11 29
11 53
11 71
13 7
13 19
13 61
13 67
13 73
17 3
17 23
17 41
17 47
17 53
17 59
17 83
17 89
19 3
19 7
19 13
19 31
19 73
19 79
19 97
23 3
23 11
23 41
23 47
23 71
23 83
23 89
29 3
29 17
29 53
29 71
31 3
31 7
31 19
31 37
31 67
37 3
37 19
37 61
37 67
37 79
37 97
41 11
41 29
41 53
41 59
43 3
43 37
43 73
43 97
47 23
47 29
47 59
47 83
47 89
53 23
53 47
59 3
59 23
59 53
61 3
61 7
61 13
61 31
61 43
61 73
61 97
67 3
67 7
67 19
67 37
67 61
67 79
71 29
71 59
73 3
73 31
79 7
79 19
79 37
83 11
83 17
83 29
83 53
83 89
89 23
89 29
89 41
89 71
97 7
97 19
97 43
97 67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment