Strange plus numbers: Difference between revisions

m (→‎{{header|Phix}}: added syntax colouring the hard way)
Line 795:
383, 385, 389, 411, 412, 414, 416, 430, 432, 434, 438, 470,
474, 476, 492, 494, 498]</pre>
 
=={{header|Nim}}==
<lang Nim>const Primes = {2, 3, 5, 7, 11, 13, 17}
 
proc digits(n: 100..999): array[3, int] =
[n div 100, n div 10 mod 10, n mod 10]
 
var count = 0
for n in 101..<500:
let d = n.digits
if d[0] + d[1] in Primes and d[1] + d[2] in Primes:
inc count
stdout.write n, if count mod 13 == 0: '\n' else: ' '</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>
 
=={{header|Perl}}==
Anonymous user