Jump to content

Cousin primes: Difference between revisions

→‎{{header|ALGOL 68}}: Make output more compact
(Added solution for Action!)
(→‎{{header|ALGOL 68}}: Make output more compact)
Line 164:
# have a pair of cousin primes #
p count +:= 1;
IFprint( ODD( pwhole( counti, THEN-5 ), "-", right pad( whole( i + 4, 0 ), 5 ) ) );
print( ( whole(IF p count, -5MOD ),10 ":= 0 ",THEN wholeprint( i, -5 ), "-", right pad( whole( i + 4, 0newline ), 5 ) ) )FI
ELSE
print( ( " ", whole( i, -5 ), "-", whole( i + 4, 0 ), newline ) )
FI
FI
FI
Line 176 ⟶ 173:
{{out}}
<pre>
1:3-7 3-7-11 13-17 7 19-1123 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
41: 967-971
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
41: 967-971
Found 41 cousin primes
</pre>
3,038

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.