login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Palindromic primes with just two distinct digits.
3

%I #14 Sep 12 2018 01:12:55

%S 101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,11311,

%T 11411,13331,15551,16661,18181,19991,32323,33533,35353,72227,72727,

%U 74747,75557,76667,77377,77477,77977,78787,78887,79997,94949,95959

%N Palindromic primes with just two distinct digits.

%H Robert Israel, <a href="/A056730/b056730.txt">Table of n, a(n) for n = 1..10000</a>

%p f:= proc(d) local d1,d2,L,cand,C1,C2,C3,a,b,n,Cands;

%p Cands:= NULL;

%p d1:= (d+1)/2;

%p d2:= d-d1;

%p for b in [1,3,7,9] do

%p for a in {$0..9} minus {b} do

%p for n from 2^(d1-1) to 2^d1-2 do

%p L:= convert(n,base,2);

%p C1:= a*(10^d-1)/9;

%p C2:= (b-a)*add(L[i]*10^(i+d2-1),i=1..d1);

%p C3:= (b-a)*add(L[i]*10^(d1-i),i=2..d1);

%p cand:= C1+C2+C3;

%p if isprime(cand) then Cands:= Cands, cand; fi

%p od od od;

%p sort([Cands])

%p end proc:

%p map(op, [seq(f(d),d=3..7,2)]); # _Robert Israel_, Sep 09 2018

%t Select[ Range[ 1, 3 10^6, 2 ], PrimeQ[ # ] && Length[ Union[ RealDigits[ # ][ [ 1 ] ] ] ] == 2 && RealDigits[ # ][ [ 1 ] ] == Reverse[ RealDigits[ # ][ [ 1 ] ] ] & ]

%Y Intersection of A002385 and A031955.

%K nonn,base

%O 1,1

%A _Robert G. Wilson v_, Aug 11 2000

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 23 16:16 EDT 2024. Contains 376178 sequences. (Running on oeis4.)