cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A029971 Palindromic primes in base 3.

This page as a plain text file.
%I A029971 #19 Aug 11 2024 14:41:30
%S A029971 2,13,23,151,173,233,757,937,1093,1249,1429,1487,1667,1733,1823,1913,
%T A029971 1979,2069,8389,9103,10111,12301,14951,16673,16871,18593,60103,60913,
%U A029971 61507,63127,69697,73243,78979,80599,82003,82813,83407,85027
%N A029971 Palindromic primes in base 3.
%C A029971 Intersection of A000040 and A014190. - _Michel Marcus_, Aug 19 2015
%H A029971 Chai Wah Wu, <a href="/A029971/b029971.txt">Table of n, a(n) for n = 1..3004</a>
%H A029971 P. De Geest, <a href="https://www.worldofnumbers.com/palpri.htm">World!Of Palindromic Primes</a>
%p A029971 N:= 14: # to get all terms < 3^N
%p A029971 Res:= 2:
%p A029971 digrev:=proc(n) local L;
%p A029971   L:= convert(n,base,3);
%p A029971   add(L[-i]*3^(i-1),i=1..nops(L))
%p A029971 end proc;
%p A029971 for d from 2 to N do
%p A029971   if d::even then
%p A029971     m:= d/2;
%p A029971     Res:= Res, op(select(isprime,[seq](n*3^m + digrev(n), n=3^(m-1)..3^m-1)));
%p A029971   else
%p A029971     m:= (d-1)/2;
%p A029971     Res:= Res, op(select(isprime,[seq](seq(n*3^(m+1)+y*3^m+digrev(n),
%p A029971       y=0..2), n=3^(m-1)..3^m-1)));
%p A029971   fi
%p A029971 od:
%p A029971 Res; # _Robert Israel_, Aug 19 2015
%t A029971 Do[s = RealDigits[n, 3][[1]]; If[PrimeQ[n], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]], {n, 1, 8500}]
%t A029971 Select[Prime[Range[8300]], Reverse[x = IntegerDigits[#, 3]] == x &] (* _Jayanta Basu_, Jun 23 2013 *)
%o A029971 (PARI) lista(nn) = forprime(p=2, nn, if ((d=digits(p,3)) && (Vecrev(d)==d), print1(p, ", "))); \\ _Michel Marcus_, Aug 19 2015
%Y A029971 Cf. A117698 (in base 3), A014190.
%K A029971 nonn,base
%O A029971 1,1
%A A029971 _Patrick De Geest_