Strange plus numbers: Difference between revisions

Added Algol 68
(Added Algol 68)
Line 39:
389 411 412 414 416 430 432 434 438 470
474 476 492 494 498
</pre>
 
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
<lang algol68>BEGIN # find numbers where the sum of the first 2 digits is prime and also #
# the sum of the second 2 digits is prime #
# considers numbers n where 100 < n < 500 #
PR read "primes.incl.a68" PR
[]BOOLprime = PRIMESIEVE 18; # note: PRIMESIEVE includes 0 in the sieve #
INT s count := 0;
FOR n FROM 101 TO 499 DO
INT v := n;
INT d1 = v MOD 10; v OVERAB 10;
INT d2 = v MOD 10; v OVERAB 10;
INT d3 = v;
IF prime[ d1 + d2 ] AND prime[ d2 + d3 ] THEN
print( ( " ", whole( n, -3 ) ) );
IF ( s count +:= 1 ) MOD 10 = 0 THEN print( ( newline ) ) FI
FI
OD
END</lang>
{{out}}
<pre>
111 112 114 116 120 121 123 125 129 141
143 147 149 161 165 167 202 203 205 207
211 212 214 216 230 232 234 238 250 252
256 258 292 294 298 302 303 305 307 320
321 323 325 329 341 343 347 349 383 385
389 411 412 414 416 430 432 434 438 470
474 476 492 494 498
</pre>
 
3,047

edits