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-10 of 10 results.

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.

A006341 Octal palindromes which are also primes.

Original entry on oeis.org

2, 3, 5, 7, 111, 131, 141, 161, 323, 343, 373, 535, 565, 717, 737, 747, 767, 10301, 10601, 11511, 12421, 12621, 13031, 13331, 15151, 16561, 17471, 30403, 30503, 30703, 31313, 31713, 32023, 32323, 33433, 34343, 34443, 35053, 35353, 36463, 36563, 36763, 37473
Offset: 1

Views

Author

James Carlson (carlson(AT)xylogics.com)

Keywords

Crossrefs

Cf. A029976.

Programs

  • C
    main(n,i,a,m){while(i=++n) for(a=0; a
    				

Extensions

More terms from David W. Wilson.

A333421 Primes that are palindromic in factorial base.

Original entry on oeis.org

3, 7, 11, 41, 127, 139, 173, 179, 191, 751, 811, 5113, 5167, 5419, 5443, 6581, 6659, 6737, 6761, 6833, 6863, 6911, 6959, 40609, 40897, 41047, 41479, 42061, 42349, 42499, 42643, 42787, 50549, 51131, 51419, 51563, 52289, 52433, 52583, 52727, 363361, 363481, 365473
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			3 is a term since it is a prime number and its factorial base representation is 11 which is a palindrome.
		

Crossrefs

Programs

  • Mathematica
    max = 9; Select[Range[0, max! - 1], PrimeQ[#] && PalindromeQ @ IntegerDigits[#, MixedRadix[Range[max, 2, -1]]] &]

A230820 Table, read by antidiagonals, of palindromic primes in base b expressed in decimal.

Original entry on oeis.org

3, 2, 5, 2, 13, 7, 2, 3, 23, 17, 2, 3, 5, 151, 31, 2, 3, 31, 17, 173, 73, 2, 3, 5, 41, 29, 233, 107, 2, 3, 5, 7, 67, 59, 757, 127, 2, 3, 5, 71, 37, 83, 257, 937, 257, 2, 3, 5, 7, 107, 43, 109, 373, 1093, 313, 2, 3, 5, 7, 73, 157, 61, 701, 409, 1249, 443
Offset: 1

Views

Author

Robert G. Wilson v, Oct 30 2013

Keywords

Examples

			\r
b\
.2.3...5...7...17...31...73..107..127...257...313...443..1193..1453..1571.=A016041
.3.2..13..23..151..173..233..757..937..1093..1249..1429..1487..1667..1733.=A029971
.4.2...3...5...17...29...59..257..373...409...461...509...787...839...887.=A029972
.5.2...3..31...41...67...83..109..701...911..1091..1171..1277..1327..1667.=A029973
.6.2...3...5....7...37...43...61...67...191...197..1297..1627..1663..1699.=A029974
.7.2...3...5...71..107..157..257..271...307..2549..2647..2801..3347..3697.=A029975
.8.2...3...5....7...73...89...97..113...211...227...251...349...373...463.=A029976
.9.2...3...5....7..109..127..173..191...227...337...373...419...601...619.=A029977
10.2...3...5....7...11..101..131..151...181...191...313...353...373...383.=A002385
11.2...3...5....7..199..277..421..443...499...521...587...643...709...743.=A029978
12.2...3...5....7...11...13..157..181...193...229...241...277...761...773.=A029979
...
inf..2..3..5..7..11..13..17..19..23..29..31..37..41..43..47..53..59..61...=A000040
		

Crossrefs

Programs

  • Maple
    A230820 := proc(b,n)
        option remember;
        local a,dgs ;
        if n = 1 then
            if b = 2 then
                return 3;
            else
                return 2;
            end if;
        else
            for a from procname(b,n-1)+1 do
                if isprime(a) then
                    ispal := true ;
                    dgs := convert(a,base,b) ;
                    for i from 1 to nops(dgs)/2 do
                        if op(i,dgs) <> op(-i,dgs) then
                            ispal := false;
                        end if;
                    end do:
                    if ispal then
                        return a;
                    end if;
                end if;
            end do:
        end if;
    end proc:
    for b from 2 to 9 do
        for n from 1 to 9 do
            printf("%3d ",A230820(b,n)) ;
        end do:
        printf("\n") ;
    end do; # R. J. Mathar, Feb 16 2014
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[ n, base]}, idn == Reverse@ idn]; Table[Select[Prime@Range@500, palQ[#, k + 1] &][[b - k + 1]], {b, 11}, {k, b, 1, -1}] // Flatten

A333424 Primes that are palindromes in primorial base.

Original entry on oeis.org

3, 7, 11, 31, 47, 211, 223, 229, 281, 293, 2311, 2347, 2383, 2843, 2879, 30091, 30181, 30211, 30307, 30367, 30427, 30493, 30553, 30643, 30829, 30859, 34871, 34961, 35051, 35117, 35267, 35363, 35393, 35423, 510751, 511711, 513067, 513307, 515143, 517459, 518179
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2020

Keywords

Examples

			3 is a term since it is a prime number and its representation in primorial base is 11 (1 * 2# + 1) which is a palindrome.
		

Crossrefs

Programs

  • Mathematica
    max = 8; bases = Prime @ Range[max, 1, -1]; nmax = Times @@ bases - 1; Select[Range[nmax], PrimeQ[#] && PalindromeQ @ IntegerDigits[#, MixedRadix[bases]] &]

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

A168110 Palindromic primes in base 8 which are also emirps (A006567) in base 10.

Original entry on oeis.org

73, 97, 113, 12547, 12611, 13259, 13523, 14107, 14563, 14891, 15667, 15731, 30367, 31799, 31991, 312073, 318281, 350033, 359377, 366169, 371353, 372377, 383833, 392153, 393761, 397921, 792131, 796291, 936227, 936739, 948707, 966379, 992947, 1005427, 1008563, 1029883, 1043899, 1048571, 1311749, 1313797, 1340357, 1358029
Offset: 1

Views

Author

Jonathan Vos Post, Nov 18 2009

Keywords

Comments

What is a good way in the OEIS to show other such pairs of bases analogous to this?

Examples

			a(1) = 73 because 73 (base 8) = 111 (which is a palindrome), and R(73) = 37 which is a different prime (base 10). a(2) = 97 because 97 (base 8) = 141 (which is a palindrome), and R(97) = 79 which is a different prime (base 10). a(3) = 113 because 113 (base 8) = 161 (which is a palindrome), and R(113) = 311 which is a different prime (base 10). a(4) = 12547 because 12547 (base 8) = 30403 (which is a palindrome), and R(12547) = 74521 which is a different prime (base 10).
		

Crossrefs

Programs

  • Maple
    isA006567 := proc(p) local r; if isprime(p) then r := digrev(p) ; r <> p and isprime(r) ; else false; end if; end proc: isA029803 := proc(n) local dgs,d; dgs := convert(n,base,8) ; for d from 1 to nops(dgs)/2 do if op(d,dgs) <> op(-d,dgs) then return false; end if; end do ; return true; end proc: isA029976 := proc(n) isprime(n) and isA029803(n) ; end proc: isA168110 := proc(p) isA029976(p) and isA006567(p) ; end proc: A168110 := proc(n) option remember ; local a; if n = 1 then 73 ; else a := nextprime(procname(n-1)) ; while not isA168110(a) do a := nextprime(a) ; end do ; return a; end if; end proc: seq(A168110(n),n=1..30) ; # R. J. Mathar, Dec 06 2009
  • Mathematica
    okQ[n_]:=Module[{fridn=FromDigits[Reverse[IntegerDigits[n]]], idn8= IntegerDigits[n,8]}, fridn!=n&&PrimeQ[fridn]&&idn8==Reverse[idn8]]; Select[Prime[Range[75000]],okQ] (* Harvey P. Dale, Aug 10 2011 *)

Formula

A029976 INTERSECTION A006567.

Extensions

Terms beyond a(10) by R. J. Mathar, Dec 06 2009

A046477 Primes that are palindromic in bases 8 and 10.

Original entry on oeis.org

2, 3, 5, 7, 373, 13331, 30103, 1496941, 1970791
Offset: 1

Views

Author

Patrick De Geest, Aug 15 1998

Keywords

Comments

Any other terms have more than 20 digits. - Michael S. Branicky, Dec 19 2020

Examples

			373_10 = 565_8. - _Jon E. Schoenfield_, Apr 10 2021
		

Crossrefs

Programs

  • Mathematica
    Do[s = RealDigits[n, 8][[1]]; t = RealDigits[n, 10][[1]]; If[PrimeQ[n], If[FromDigits[t] == FromDigits[Reverse[t]], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]]], {n, 1, 10^5}]
    pal810Q[p_]:=PalindromeQ[p]&&IntegerDigits[p,8]==Reverse[IntegerDigits[p,8]]; Select[ Prime[ Range[150000]],pal810Q] (* Harvey P. Dale, May 25 2023 *)
  • PARI
    is(n) = my(d=digits(n, 8), dd=digits(n)); d==Vecrev(d) && dd==Vecrev(dd)
    forprime(p=1, , if(is(p), print1(p, ", "))) \\ Felix Fröhlich, Dec 20 2020
  • Python
    # efficiently search to large numbers
    from sympy import isprime
    from itertools import product
    def candidate_prime_pals(digits):
      ruled_out = "024568" # can't be even or multiple of 5
      midrange = [[""], "0123456789"]
      for p in product("0123456789", repeat=digits//2):
        left = "".join(p)
        if len(left):
          if left[0] in ruled_out: continue
        for middle in midrange[digits%2]:
          yield left+middle+left[::-1]
    for digits in range(1, 15):
      for p in candidate_prime_pals(digits):
        intp = int(p); octp = oct(intp)[2:]
        if octp==octp[::-1]:
          if isprime(intp):
            print(intp, end=", ") # Michael S. Branicky, Dec 19 2020
    
  • Python
    # alternate sufficient for producing terms through a(9)
    from sympy import isprime
    def ispal(n): strn = str(n); return strn==strn[::-1]
    for n in range(10**7):
      if ispal(n) and ispal(oct(n)[2:]) and isprime(n):
        print(n) # Michael S. Branicky, Dec 20 2020
    

A056145 Palindromic primes in bases 2 and 8.

Original entry on oeis.org

3, 5, 7, 73, 28807, 31727, 262657, 295433, 1311749, 1385621, 1478189, 1540157, 1543741, 1549501, 1551037, 1865159, 1932247, 2031599, 2067007, 2085247, 2087807, 83914757, 84663941, 85742021, 85808581, 88779413, 89420117, 89466197, 89924053, 90169301, 94971053, 94983341
Offset: 1

Views

Author

Robert G. Wilson v, Jul 29 2000

Keywords

Crossrefs

Cf. A016041 and A029976.

Programs

  • Mathematica
    Do[ If[ PrimeQ[ n ], t=RealDigits[ n, 8 ][ [ 1 ] ]; If[ FromDigits[ t ]==FromDigits[ Reverse[ t ] ], s=RealDigits[ n, 2 ][ [ 1 ] ]; If[ FromDigits[ s ]==FromDigits[ Reverse[ s ] ], Print[ n ] ] ] ], {n, 1, 10^8} ]
    Select[Prime[Range[155000]],PalindromeQ[IntegerDigits[#,2]] && PalindromeQ[ IntegerDigits[ #,8]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 23 2017 *)

Extensions

More terms from Harvey P. Dale, Sep 23 2017

A056146 Palindromic primes in bases 4 and 8.

Original entry on oeis.org

2, 3, 5, 373, 4289, 6761, 14891, 15083, 1311749, 1313797, 1444901, 1530229, 1531253, 17480321, 17563841, 17730241, 17734337, 27263017, 27533417, 27957929, 28053737, 50339843, 50506243, 50856067, 51122371, 61254251
Offset: 1

Views

Author

Robert G. Wilson v, Jul 29 2000

Keywords

Crossrefs

Cf. A029972 and A029976.

Programs

  • Mathematica
    Do[ If[PrimeQ[n], t = RealDigits[n, 8][[1]]; If[FromDigits[t] == FromDigits[Reverse[t]], s = RealDigits[n, 4][[1]]; If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]]], {n, 1, 10^8, 2}]
Showing 1-10 of 10 results.