Primes which contain only one odd digit: Difference between revisions
Content added Content deleted
m (→{{header|Quackery}}: tweaked code) |
(→J: add) |
||
Line 601: | Line 601: | ||
pw = printf . flip intercalate ["%", "s"] . show |
pw = printf . flip intercalate ["%", "s"] . show |
||
in unlines $ intercalate gap . zipWith pw ws <$> rows</syntaxhighlight> |
in unlines $ intercalate gap . zipWith pw ws <$> rows</syntaxhighlight> |
||
{{ |
{{out}} |
||
<pre>Below 1000: |
<pre>Below 1000: |
||
3 5 7 23 29 41 43 47 61 67 |
3 5 7 23 29 41 43 47 61 67 |
||
Line 611: | Line 611: | ||
Count of matches below 10E6: |
Count of matches below 10E6: |
||
2560</pre> |
2560</pre> |
||
=={{header|J}}== |
|||
<syntaxhighlight lang="j"> getOneOdds=. #~ (1 = 2 +/@:| "."0@":)"0 |
|||
primesTo=. i.&.(p:inv) |
|||
_15 ]\ getOneOdds primesTo 1000 |
|||
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 |
|||
# getOneOdds primesTo 1e6 |
|||
2560</syntaxhighlight> |
|||
=={{header|jq}}== |
=={{header|jq}}== |