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

 


Primes which are palindromes in 3 or more bases.
1

%I #9 May 01 2020 21:25:06

%S 17,31,67,73,107,109,127,151,157,173,181,191,197,211,227,241,257,271,

%T 277,307,313,337,353,373,379,401,409,419,421,433,443,457,461,463,487,

%U 521,523,541,577,587,601,617,619,631,647,661,673,683,701,719,727,743,757,761,773,787,797,809,857,859

%N Primes which are palindromes in 3 or more bases.

%C For the purposes of this sequence, single digits are not counted as palindromes (otherwise every number n is a palindrome in all bases > n). - _Robert Israel_, May 01 2020

%H Robert Israel, <a href="/A087166/b087166.txt">Table of n, a(n) for n = 1..5867</a>

%e 31 is in the list, as 31 base 2 = 11111, 31 base 5 = 111 and 31 base 30 = 11, i.e. three different ways.

%p N:= 1000: # for all terms <= N

%p digrev:= proc(n,b)

%p local L,i;

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

%p add(L[-i]*b^(i-1),i=1..nops(L))

%p end proc:

%p bpalis:= proc(b, N)

%p local Res,dmax,d,m;

%p dmax:= floor(log[b](N))+1;

%p if dmax < 2 then return [] fi;

%p Res:= seq(i*(b+1),i=1..b-1);

%p for d from 3 to dmax do

%p if d::even then

%p m:= d/2;

%p Res:= Res, seq(n*b^m + digrev(n,b),n=b^(m-1)..b^m-1);

%p else

%p m:= (d-1)/2;

%p Res:= Res, seq(seq(n*b^(m+1)+y*b^m+digrev(n,b), y=0..b-1), n=b^(m-1)..b^m-1);

%p fi

%p od;

%p select(`<=`,[Res], N)

%p end proc:

%p V:= Vector(N):

%p for b from 2 to N-1 do

%p bp:= bpalis(b,N);

%p V[bp]:= V[bp] +~ 1

%p od:

%p select(p -> isprime(p) and V[p] >= 3, [seq(i,i=3..N,2)]); # _Robert Israel_, May 01 2020

%Y Primes in A253594.

%K base,nonn

%O 1,1

%A _Randy L. Ekl_, Oct 18 2003

%E Corrected by _Robert Israel_, May 01 2020

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 18:10 EDT 2024. Contains 376182 sequences. (Running on oeis4.)