Primes which contain only one odd digit: Difference between revisions
Primes which contain only one odd digit (view source)
Revision as of 22:04, 5 August 2021
, 2 years agoAdd Factor
Catskill549 (talk | contribs) (added AWK) |
(Add Factor) |
||
Line 123:
<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
</pre>
=={{header|Factor}}==
{{libheader|Factor-numspec}}
{{works with|Factor|0.99 2021-06-02}}
<lang factor>USING: grouping io lists lists.lazy literals math math.primes
numspec prettyprint ;
<<
DIGIT: o 357
DIGIT: q 1379
DIGIT: e 2468
DIGIT: E 02468
NUMSPEC: one-odd-candidates o eq eEq ... ;
>>
CONSTANT: p $[ one-odd-candidates [ prime? ] lfilter ]
"Primes with one odd digit under 1,000:" print
p [ 1000 < ] lwhile list>array 9 group simple-table.
"\nCount of such primes under 1,000,000:" print
p [ 1,000,000 < ] lwhile llength .
"\nCount of such primes under 1,000,000,000:" print
p [ 1,000,000,000 < ] lwhile llength .</lang>
{{out}}
<pre>
Primes with one odd digit under 1,000:
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
Count of such primes under 1,000,000:
2560
Count of such primes under 1,000,000,000:
202635
</pre>
|