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.

Original entry on oeis.org

2, 13, 23, 151, 173, 233, 757, 937, 1093, 1249, 1429, 1487, 1667, 1733, 1823, 1913, 1979, 2069, 8389, 9103, 10111, 12301, 14951, 16673, 16871, 18593, 60103, 60913, 61507, 63127, 69697, 73243, 78979, 80599, 82003, 82813, 83407, 85027
Offset: 1

Views

Author

Keywords

Comments

Intersection of A000040 and A014190. - Michel Marcus, Aug 19 2015

Crossrefs

Cf. A117698 (in base 3), A014190.

Programs

  • Maple
    N:= 14: # to get all terms < 3^N
    Res:= 2:
    digrev:=proc(n) local L;
      L:= convert(n,base,3);
      add(L[-i]*3^(i-1),i=1..nops(L))
    end proc;
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, op(select(isprime,[seq](n*3^m + digrev(n), n=3^(m-1)..3^m-1)));
      else
        m:= (d-1)/2;
        Res:= Res, op(select(isprime,[seq](seq(n*3^(m+1)+y*3^m+digrev(n),
          y=0..2), n=3^(m-1)..3^m-1)));
      fi
    od:
    Res; # Robert Israel, Aug 19 2015
  • Mathematica
    Do[s = RealDigits[n, 3][[1]]; If[PrimeQ[n], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]], {n, 1, 8500}]
    Select[Prime[Range[8300]], Reverse[x = IntegerDigits[#, 3]] == x &] (* Jayanta Basu, Jun 23 2013 *)
  • PARI
    lista(nn) = forprime(p=2, nn, if ((d=digits(p,3)) && (Vecrev(d)==d), print1(p, ", "))); \\ Michel Marcus, Aug 19 2015