Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #16 Dec 18 2015 03:10:28
%S 3,5,353,33533,35353,3353533,3553553,333535333,335333533,355353553,
%T 355555553,33335353333,33553335533,35533333553,35553535553,
%U 3335535355333,3335555555333,3353353533533,3353355533533,3355535355533,3533355533353,3533533353353
%N Palindromic primes using only digits 3 and 5.
%H Chai Wah Wu, <a href="/A138584/b138584.txt">Table of n, a(n) for n = 1..5382</a>
%p revdigs:= proc(n) option remember;
%p local b;
%p if n < 10 then return n fi;
%p b:= n mod 10;
%p b*10^ilog10(n) + procname((n-b)/10);
%p end proc:
%p A:= {3,5}:
%p B:= [0]:
%p for d from 2 to 20 do
%p if d::even then
%p B:= map(t -> (10*t+3,10*t+5), B);
%p A:= A union select(isprime, {seq(revdigs(b)+10^(d/2)*b,b=B)});
%p else
%p A:= A union select(isprime, {seq(seq(
%p revdigs(b)+i*10^((d-1)/2)+10^((d+1)/2)*b, i = [3,5]),b=B)});
%p fi
%p od:
%p sort(convert(A,list)); # _Robert Israel_, Dec 17 2015
%o (Python)
%o from itertools import product
%o from sympy import isprime
%o A138584_list = []
%o for l in range(17):
%o for d in product('35',repeat=l):
%o s = ''.join(d)
%o n = int(s+'3'+s[::-1])
%o if isprime(n):
%o A138584_list.append(n)
%o n += 2*10**l
%o if isprime(n):
%o A138584_list.append(n) # _Chai Wah Wu_, Dec 17 2015
%Y Cf. A020462.
%K nonn,base
%O 1,1
%A _Paul Curtz_, May 13 2008
%E More terms from _Arkadiusz Wesolowski_, Dec 31 2011