Primes which contain only one odd digit: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: minor optimizations and simplifications) |
|||
Line 157: | Line 157: | ||
println("Found $(length(found)) primes with one odd digit in base 10:") |
println("Found $(length(found)) primes with one odd digit in base 10:") |
||
foreach(p -> print(rpad(last(p), 5), first(p) % 9 == 0 ? "\n" : ""), enumerate(found)) |
foreach(p -> print(rpad(last(p), 5), first(p) % 9 == 0 ? "\n" : ""), enumerate(found)) |
||
println("\nThere are ", count(isoneoddprime, primes(1_000_000)), |
|||
" primes with only one odd digit in base 10 between 1 and 1,000,000." |
|||
</lang>{{out}} |
</lang>{{out}} |
||
<pre> |
<pre> |
||
Line 165: | Line 168: | ||
467 487 601 607 641 643 647 661 683 |
467 487 601 607 641 643 647 661 683 |
||
809 821 823 827 829 863 881 883 887 |
809 821 823 827 829 863 881 883 887 |
||
There are 2560 primes with only one odd digit in base 10 between 1 and 1,000,000. |
|||
</pre> |
</pre> |
||