login
A138584
Palindromic primes using only digits 3 and 5.
1
3, 5, 353, 33533, 35353, 3353533, 3553553, 333535333, 335333533, 355353553, 355555553, 33335353333, 33553335533, 35533333553, 35553535553, 3335535355333, 3335555555333, 3353353533533, 3353355533533, 3355535355533, 3533355533353, 3533533353353
OFFSET
1,1
MAPLE
revdigs:= proc(n) option remember;
local b;
if n < 10 then return n fi;
b:= n mod 10;
b*10^ilog10(n) + procname((n-b)/10);
end proc:
A:= {3, 5}:
B:= [0]:
for d from 2 to 20 do
if d::even then
B:= map(t -> (10*t+3, 10*t+5), B);
A:= A union select(isprime, {seq(revdigs(b)+10^(d/2)*b, b=B)});
else
A:= A union select(isprime, {seq(seq(
revdigs(b)+i*10^((d-1)/2)+10^((d+1)/2)*b, i = [3, 5]), b=B)});
fi
od:
sort(convert(A, list)); # Robert Israel, Dec 17 2015
PROG
(Python)
from itertools import product
from sympy import isprime
A138584_list = []
for l in range(17):
for d in product('35', repeat=l):
s = ''.join(d)
n = int(s+'3'+s[::-1])
if isprime(n):
A138584_list.append(n)
n += 2*10**l
if isprime(n):
A138584_list.append(n) # Chai Wah Wu, Dec 17 2015
CROSSREFS
Cf. A020462.
Sequence in context: A280035 A087670 A271390 * A277995 A354245 A247699
KEYWORD
nonn,base
AUTHOR
Paul Curtz, May 13 2008
EXTENSIONS
More terms from Arkadiusz Wesolowski, Dec 31 2011
STATUS
approved