The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A029971 Palindromic primes in base 3. 12

%I #18 Oct 17 2015 18:09:23

%S 2,13,23,151,173,233,757,937,1093,1249,1429,1487,1667,1733,1823,1913,

%T 1979,2069,8389,9103,10111,12301,14951,16673,16871,18593,60103,60913,

%U 61507,63127,69697,73243,78979,80599,82003,82813,83407,85027

%N Palindromic primes in base 3.

%C Intersection of A000040 and A014190. - _Michel Marcus_, Aug 19 2015

%H Chai Wah Wu, <a href="/A029971/b029971.txt">Table of n, a(n) for n = 1..3004</a>

%H P. De Geest, <a href="http://www.worldofnumbers.com/palpri.htm">World!Of Palindromic Primes</a>

%p N:= 14: # to get all terms < 3^N

%p Res:= 2:

%p digrev:=proc(n) local L;

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

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

%p end proc;

%p for d from 2 to N do

%p if d::even then

%p m:= d/2;

%p Res:= Res, op(select(isprime,[seq](n*3^m + digrev(n), n=3^(m-1)..3^m-1)));

%p else

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

%p Res:= Res, op(select(isprime,[seq](seq(n*3^(m+1)+y*3^m+digrev(n),

%p y=0..2), n=3^(m-1)..3^m-1)));

%p fi

%p od:

%p Res; # _Robert Israel_, Aug 19 2015

%t Do[s = RealDigits[n, 3][[1]]; If[PrimeQ[n], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]], {n, 1, 8500}]

%t Select[Prime[Range[8300]], Reverse[x = IntegerDigits[#, 3]] == x &] (* _Jayanta Basu_, Jun 23 2013 *)

%o (PARI) lista(nn) = forprime(p=2, nn, if ((d=digits(p,3)) && (Vecrev(d)==d), print1(p, ", "))); \\ _Michel Marcus_, Aug 19 2015

%Y Cf. A117698 (in base 3), A014190.

%K nonn,base

%O 1,1

%A _Patrick De Geest_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 May 25 15:06 EDT 2024. Contains 372792 sequences. (Running on oeis4.)