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.

Showing 1-3 of 3 results.

A029976 Palindromic primes in base 8.

Original entry on oeis.org

2, 3, 5, 7, 73, 89, 97, 113, 211, 227, 251, 349, 373, 463, 479, 487, 503, 4289, 4481, 4937, 5393, 5521, 5657, 5849, 6761, 7537, 7993, 12547, 12611, 12739, 13003, 13259, 13331, 13523, 14107, 14563, 14627, 14891, 15083, 15667, 15731, 15859
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A006341.

Programs

  • Mathematica
    palQ[n_, b_:10] := Module[{idn = IntegerDigits[n, b]}, idn == Reverse[idn]]; Select[Prime[Range[2000]], palQ[#, 8] &] (* Harvey P. Dale, Dec 23 2013 *)
  • PARI
    forprime(p=2,10^4, my(d=digits(p,8)); if(d==Vecrev(d),print1(p,", "))); \\ Joerg Arndt, Aug 17 2014
  • Python
    from itertools import chain
    from sympy import isprime
    from gmpy2 import digits
    A029976 = sorted((n for n in chain((int(digits(x,8)+digits(x,8)[::-1],8) for x in range(1,8**6)),(int(digits(x,8)+digits(x,8)[-2::-1],8) for x in range(1,8**6))) if isprime(n)))
    # Chai Wah Wu, Aug 16 2014
    

A117785 Total number of palindromic primes in base 8 below 8^n.

Original entry on oeis.org

4, 4, 17, 17, 64, 64, 375, 375, 2319, 2319, 15130, 15130, 99554, 99554, 675166, 675166, 4753617, 4753617, 33752394, 33752394, 239605153, 239605153
Offset: 1

Views

Author

Martin Renner, Apr 15 2006

Keywords

Comments

Every palindrome with an even number of digits is divisible by 11 (in base 8) and therefore is composite (not prime). Hence there is no palindromic prime with an even number of digits.

Crossrefs

Partial sums of A117786.

Programs

  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,8);
      add(L[-i]*8^(i-1),i=1..nops(L))
    end proc:
    f:= proc(d) local x,y;
         nops(select(isprime, [seq(seq(x*8^(d+1)+y*8^d+revdigs(x), y=0..7),x=8^(d-1)..8^d-1)]));
    end proc:
    T:= ListTools:-PartialSums([4, op(map(f,[$1..6]))]):
    map(t -> (t,t), T); # Robert Israel, Aug 01 2019

Extensions

a(9)-a(22) from Robert Israel, Aug 01 2019, using data from A117786.

A117786 Total number of palindromic primes in base 8 with n digits.

Original entry on oeis.org

4, 0, 13, 0, 47, 0, 311, 0, 1944, 0, 12811, 0, 84424, 0, 575612, 0, 4078451, 0, 28998777, 0, 205852759, 0
Offset: 1

Views

Author

Martin Renner, Apr 15 2006

Keywords

Comments

Every palindrome with an even number of digits is divisible by 11 (in base 8) and therefore is composite (not prime). Hence there is no palindromic prime with an even number of digits.

Crossrefs

Extensions

a(9)-a(22) from Chai Wah Wu, Dec 25 2015
Showing 1-3 of 3 results.