Erdős-primes: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: changed some whitespace and comments. |
julia example |
||
Line 8: | Line 8: | ||
Optionally, show the '''number''' of Erdős-primes. |
Optionally, show the '''number''' of Erdős-primes. |
||
=={{header|Julia}}== |
|||
<lang julia>using Primes |
|||
let |
|||
p = primesmask(500) |
|||
println("Erdős primes under 500:") |
|||
pcount = 0 |
|||
for i in 2:499 |
|||
if p[i] && p[sum(digits(i))] |
|||
pcount += 1 |
|||
print(lpad(i, 4), pcount % 20 == 0 ? "\n" : "") |
|||
end |
|||
end |
|||
println("\n\n$pcount Erdős primes found.") |
|||
end |
|||
</lang>{{out}} |
|||
<pre> |
|||
Erdős primes under 500: |
|||
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 Erdős primes found. |
|||
</pre> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |