Primes which contain only one odd digit: Difference between revisions
Primes which contain only one odd digit (view source)
Revision as of 13:20, 4 March 2023
, 1 year agoadded Arturo
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 144:
Found 2560 single-odd-digit primes upto 1000000
</pre>
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">onlyOneOddDigit?: function [n][
and? -> prime? n
-> one? select digits n => odd?
]
primesWithOnlyOneOddDigit: select 1..1000 => onlyOneOddDigit?
loop split.every: 9 primesWithOnlyOneOddDigit 'x ->
print map x 's -> pad to :string s 4
nofPrimesBelow1M: enumerate 1..1000000 => onlyOneOddDigit?
print ""
print ["Found" nofPrimesBelow1M "primes with only one odd digit below 1000000."]</syntaxhighlight>
{{out}}
<pre> 3 5 7 23 29 41 43 47 61
67 83 89 223 227 229 241 263 269
281 283 401 409 421 443 449 461 463
467 487 601 607 641 643 647 661 683
809 821 823 827 829 863 881 883 887
Found 2560 primes with only one odd digit below 1000000.</pre>
=={{header|AWK}}==
|