login
A345728
Primes with an odd number of digits and 0 as the middle digit.
0
101, 103, 107, 109, 307, 401, 409, 503, 509, 601, 607, 701, 709, 809, 907, 10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 11003, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11093, 12007, 12011, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 13001, 13003, 13007
OFFSET
1,1
MATHEMATICA
Select[Prime@Range@2000, OddQ[d=Length[s=IntegerDigits[#]]]&&s[[Ceiling[d/2]]]==0&] (* Giorgos Kalogeropoulos, Jul 04 2021 *)
PROG
(Perl)
#!/usr/bin/perl
$str = "";
foreach $cand (101..20000){ # loop over candidates
next unless &isPrime($cand); # is $cand prime? 0/1 result
@a = split("", $cand);
next if @a/2 == int @a/2;
$mid = int @a/2;
next unless $a[$mid] == 0;
$str .= "$cand, ";
}
chop $str; chop $str;
print "$str\n";
(PARI) isok(p) = {if (isprime(p), my(d=digits(p)); (#d % 2) && (d[#d\2+1] == 0); ); } \\ Michel Marcus, Jun 28 2021
(Python)
from sympy import isprime
from itertools import product
def agen(maxdigits):
for digits in range(3, maxdigits+1, 2):
for first in "123456789":
for left in product("0123456789", repeat=digits//2-1):
left = "".join(left)
for right in product("0123456789", repeat=digits//2-1):
right = "".join(right)
for last in "1379":
t = int("".join(first + left + "0" + right + last))
if isprime(t): yield t
print([an for an in agen(5)]) # Michael S. Branicky, Jun 28 2021
CROSSREFS
Cf. A000040 (primes), A134809 (Cyclops primes).
Sequence in context: A183087 A056709 A243825 * A309488 A134809 A256186
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Jun 27 2021
STATUS
approved