Palindromic primes: Difference between revisions
Content added Content deleted
(→{{header|jq}}: (corrected)) |
(→{{header|jq}}: 10^10) |
||
Line 287: | Line 287: | ||
In this entry, we define both a naive generate-and-test generator of the palindromic primes, |
In this entry, we define both a naive generate-and-test generator of the palindromic primes, |
||
and a more sophisticated one that is well-suited for generating very large numbers of such primes, |
and a more sophisticated one that is well-suited for generating very large numbers of such primes, |
||
as illustrated by counting the number less than 10^ |
as illustrated by counting the number less than 10^10. |
||
For a suitable implementation of `is_prime` as used here, see [[Erd%C5%91s-primes#jq]]. |
For a suitable implementation of `is_prime` as used here, see [[Erd%C5%91s-primes#jq]]. |
||
Line 328: | Line 328: | ||
end; |
end; |
||
# palindromes with an even number of digits are divisible by 11 |
|||
⚫ | |||
⚫ | |||
| ("1", "3", "7", "9") as $start |
| ("1", "3", "7", "9") as $start |
||
| $start + middle($mid) + $start ; |
| $start + middle($mid) + $start ; |
||
Line 373: | Line 375: | ||
Number of palindromic primes <= 1000000000: 5953 |
Number of palindromic primes <= 1000000000: 5953 |
||
⚫ | |||
Number of palindromic primes <= 10000000000: 5953 |
|||
⚫ | |||
=={{header|Julia}}== |
=={{header|Julia}}== |