Additive primes: Difference between revisions

no edit summary
(Applesoft BASIC)
No edit summary
Line 2,426:
<pre>2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487 Additive primes found: 54
=== Press any key to exit ===</pre>
 
=={{header|Picat}}==
<lang Picat>main =>
PCount = 0,
foreach (I in 2..499)
if prime(I) && prime(sum_digits(I)) then
PCount := PCount + 1,
printf("%4d ", I)
end
end,
printf("\n\n%d additive primes found.\n", PCount).
 
sum_digits(N) = S =>
S = sum([ord(C)-ord('0') : C in to_string(N)]).
</lang>
 
{{out}}
<pre>
2 3 5 7 11 23 29 41 43 47 61 67 83 89 101 113 131 137 139 151 157 173 179 191 193 197 199 223 227 229 241 263 269 281 283 311 313 317 331 337 353 359 373 379 397 401 409 421 443 449 461 463 467 487
 
54 additive primes found.
</pre>
 
=={{header|PicoLisp}}==
Anonymous user