Cousin primes: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
(→{{header|ALGOL 68}}: Make output more compact) |
||
Line 164: | Line 164: | ||
# have a pair of cousin primes # |
# have a pair of cousin primes # |
||
p count +:= 1; |
p count +:= 1; |
||
print( ( whole( i, -5 ), "-", right pad( whole( i + 4, 0 ), 5 ) ) ); |
|||
IF p count MOD 10 = 0 THEN print( ( newline ) ) FI |
|||
ELSE |
|||
print( ( " ", whole( i, -5 ), "-", whole( i + 4, 0 ), newline ) ) |
|||
FI |
|||
FI |
FI |
||
FI |
FI |
||
Line 176: | Line 173: | ||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
3-7 7-11 13-17 19-23 37-41 43-47 67-71 79-83 97-101 103-107 |
|||
109-113 127-131 163-167 193-197 223-227 229-233 277-281 307-311 313-317 349-353 |
|||
3: 13-17 19-23 |
|||
379-383 397-401 439-443 457-461 463-467 487-491 499-503 613-617 643-647 673-677 |
|||
5: 37-41 43-47 |
|||
739-743 757-761 769-773 823-827 853-857 859-863 877-881 883-887 907-911 937-941 |
|||
7: 67-71 79-83 |
|||
⚫ | |||
9: 97-101 103-107 |
|||
11: 109-113 127-131 |
|||
13: 163-167 193-197 |
|||
15: 223-227 229-233 |
|||
17: 277-281 307-311 |
|||
19: 313-317 349-353 |
|||
21: 379-383 397-401 |
|||
23: 439-443 457-461 |
|||
25: 463-467 487-491 |
|||
27: 499-503 613-617 |
|||
29: 643-647 673-677 |
|||
31: 739-743 757-761 |
|||
33: 769-773 823-827 |
|||
35: 853-857 859-863 |
|||
37: 877-881 883-887 |
|||
39: 907-911 937-941 |
|||
⚫ | |||
Found 41 cousin primes |
Found 41 cousin primes |
||
</pre> |
</pre> |