login
A056730
Palindromic primes with just two distinct digits.
3
101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 11311, 11411, 13331, 15551, 16661, 18181, 19991, 32323, 33533, 35353, 72227, 72727, 74747, 75557, 76667, 77377, 77477, 77977, 78787, 78887, 79997, 94949, 95959
OFFSET
1,1
LINKS
MAPLE
f:= proc(d) local d1, d2, L, cand, C1, C2, C3, a, b, n, Cands;
Cands:= NULL;
d1:= (d+1)/2;
d2:= d-d1;
for b in [1, 3, 7, 9] do
for a in {$0..9} minus {b} do
for n from 2^(d1-1) to 2^d1-2 do
L:= convert(n, base, 2);
C1:= a*(10^d-1)/9;
C2:= (b-a)*add(L[i]*10^(i+d2-1), i=1..d1);
C3:= (b-a)*add(L[i]*10^(d1-i), i=2..d1);
cand:= C1+C2+C3;
if isprime(cand) then Cands:= Cands, cand; fi
od od od;
sort([Cands])
end proc:
map(op, [seq(f(d), d=3..7, 2)]); # Robert Israel, Sep 09 2018
MATHEMATICA
Select[ Range[ 1, 3 10^6, 2 ], PrimeQ[ # ] && Length[ Union[ RealDigits[ # ][ [ 1 ] ] ] ] == 2 && RealDigits[ # ][ [ 1 ] ] == Reverse[ RealDigits[ # ][ [ 1 ] ] ] & ]
CROSSREFS
Intersection of A002385 and A031955.
Sequence in context: A319049 A052086 A154270 * A077798 A089360 A056728
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Aug 11 2000
STATUS
approved