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.

Previous Showing 21-30 of 287 results. Next

A039954 Palindromic primes formed from the reflected decimal expansion of Pi.

Original entry on oeis.org

3, 313, 31415926535897932384626433833462648323979853562951413
Offset: 1

Views

Author

Keywords

Comments

Carlos Rivera reports that the next two members of this sequence have 301 and 921 digits. The first has been tested with APRTE-CLE. The second one is only a StrongPseudoPrime at the moment. - May 16 2003
Thomas Spahni reports that the fifth member of this sequence with 921 digits is prime. He used Francois Morain's ECPP-V6.4.5a which proved primality in 14913.7 seconds running on a Celeron Core2 CPU at 2.00GHz. - Jun 05 2008
Primes in A135697. Terms with an odd number of digits are the primes in A135698. - Omar E. Pol, Mar 06 2012

Crossrefs

Programs

  • Mathematica
    Select[Table[p = Flatten[RealDigits[Pi, 10, d]]; (FromDigits[p] - 1)*10^(Length[p] - 3) + FromDigits[Drop[Reverse[p], 2]], {d, 27}], PrimeQ] (* Arkadiusz Wesolowski, Dec 18 2011 *)

A084092 Prime power decimal palindromes.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 9, 11, 101, 121, 131, 151, 181, 191, 313, 343, 353, 373, 383, 727, 757, 787, 797, 919, 929, 1331, 10201, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14641, 14741, 15451, 15551, 16061, 16361
Offset: 1

Views

Author

Reinhard Zumkeller, May 11 2003

Keywords

Examples

			121=A000961(42)=A002113(21), therefore 121 is a term;
131=A000961(46)=A002113(22), therefore 131 is a term.
		

Crossrefs

Intersection of A000961 and A002113, union of A002385 and A084093.

Programs

  • Mathematica
    Join[{1}, Select[Range[16370], Reverse[x = IntegerDigits[#]] == x && PrimePowerQ[#] &]] (* Jayanta Basu, Jun 24 2013 *)
    Join[{1},Select[Range[17000],PalindromeQ[#]&&PrimePowerQ[#]&]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 07 2019 *)

Extensions

Corrected and extended by T. D. Noe, Oct 25 2006

A117697 Palindromic primes in base 2 (written in base 2).

Original entry on oeis.org

11, 101, 111, 10001, 11111, 1001001, 1101011, 1111111, 100000001, 100111001, 110111011, 10010101001, 10110101101, 11000100011, 11001010011, 11011111011, 11100100111, 11101010111, 1001100011001, 1001111111001, 1010001000101
Offset: 1

Views

Author

Martin Renner, Apr 13 2006

Keywords

Crossrefs

Programs

  • Maple
    isA016041 := proc(n)
        local bin,dig ;
        if isprime(n) then
            bin := convert(n,base,2) ;
            for dig from 1 to nops(bin)/2 do
                if op(dig,bin) <> op(-dig,bin) then
                    return false;
                end if;
            end do ;
            return true;
        else
            false ;
        end if ;
    end proc:
    for i from 1 to 900 do p := ithprime(i) : if isA016041(p) then printf("%d, ",A007088(p)) ; fi ; od : # R. J. Mathar, Feb 25 2007
  • Mathematica
    pal2Q[n_] := Reverse[x = IntegerDigits[n, 2]] == x; BaseForm[Select[Prime[Range[700]], pal2Q[#] &], 2] (* Jayanta Basu, Jun 24 2013 *)
    FromDigits /@ Select[IntegerDigits[Prime@ Range[1000], 2], PalindromeQ] (* Michael De Vlieger, Oct 28 2020 *)

Formula

a(n) = A007088(A016041(n)). - R. J. Mathar, Feb 25 2007

A037010 Differences between adjacent palindromic primes.

Original entry on oeis.org

1, 2, 2, 4, 90, 30, 20, 30, 10, 122, 40, 20, 10, 344, 30, 30, 10, 122, 10, 9372, 200, 100, 710, 100, 1010, 300, 100, 510, 500, 100, 410, 400, 710, 100, 510, 300, 200, 100, 810, 500, 210, 300, 910, 500, 100, 10112
Offset: 1

Views

Author

Keywords

Examples

			E.g. 11 - 7 = 4.
		

Crossrefs

Cf. A002385, A327427 (records).

Programs

  • Mathematica
    Differences[Select[Prime[Range[3260]], Reverse[x = IntegerDigits[#]] == x &]] (* Jayanta Basu, Jun 24 2013 *)

Formula

a(n) = A002385(n+1) - A002385(n). - Michel Marcus, Sep 12 2019

A069217 Numbers n such that phi(n) + sigma(n) = n + reversal(n).

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181
Offset: 1

Views

Author

Joseph L. Pe, Apr 11 2002

Keywords

Comments

Note that all terms so far are palindromes.
It is obvious that if n is a term of the sequence greater than 1 then n is prime iff n is a palindrome. Do there exist composite terms in the sequence? - Farideh Firoozbakht, Jan 28 2006 Answer: Yes, see next comment.
Giovanni Resta writes (Sep 06 2006): The smallest composite number such that n+rev(n)=phi(n)+sigma(n) is n = 3197267223 = 3 * 79 * 677 * 19927 with rev(n) = 3227627913, phi(n) = 2101316256, sigma(n) = 4323578880 and 3197267223+3227627913 = 6424895136 = 2101316256+4323578880.

Examples

			phi(101) + sigma(101) = 202 = 101 + 101 = 101 + reversal(101).
		

Crossrefs

Contains composite terms, so is strictly different from A002385.

Programs

  • Mathematica
    Select[Range[5*10^4], EulerPhi[ # ] + DivisorSigma[1, # ] == # + FromDigits[Reverse[IntegerDigits[ # ]]] &]

Formula

If p is prime and rev(p)=p then p+rev(p)=2p=phi(p)+sigma(p) so all palindromic primes are in the sequence. - Farideh Firoozbakht, Sep 12 2006

A016115 Number of prime palindromes with n digits.

Original entry on oeis.org

4, 1, 15, 0, 93, 0, 668, 0, 5172, 0, 42042, 0, 353701, 0, 3036643, 0, 27045226, 0, 239093865, 0, 2158090933, 0, 19742800564, 0, 180815391365, 0
Offset: 1

Views

Author

Keywords

Comments

Every palindrome with an even number of digits is divisible by 11 and therefore is composite (not prime). Hence there is only one palindromic prime with an even number of digits, namely 11 itself. - Martin Renner, Apr 15 2006

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.

Crossrefs

Cf. A002113 (palindromes), A002385 (palindromic primes), A040025 (bisection), A050251 (partial sums).

Programs

  • Maple
    # A016115 Gets numbers of base-10 palindromic primes with exactly d digits, 1 <= d <= 13 (say), in the list "lis"
    lis:=[4,1];
    for d from 3 to 13 do
    if d::even then
        lis:=[op(lis),0];
    else
        m:= (d-1)/2:
        Res2 := [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:
        ct:=0; for x in Res2 do if isprime(x) then ct:=ct+1; fi: od:
        lis:=[op(lis),ct];
    fi:
    lprint(d,lis);
    od:
    lis; # N. J. A. Sloane, Oct 18 2015
  • Mathematica
    A016115[n_] := Module[{i}, If[EvenQ[n] && n > 2, Return[0]]; Return[Length[Select[Range[10^(n - 1), 10^n - 1], # == IntegerReverse[#] && PrimeQ[#] &]]]];
    Table[A016115[n], {n, 6}] (* Robert Price, May 25 2019 *)
    (* -OR-  A less straightforward implementation, but more efficient in that the palindromes are constructed instead of testing every number in the range. *)
    A016115[n_] := Module[{c, f, t0, t1},
       If[n == 2, Return[1]];
       If[EvenQ[n], Return[0]];
       c = 0; t0 = 10^((n - 1)/2); t1 = t0*10;
       For[f = t0, f < t1, f++,
        If[n != 1 && MemberQ[{2,4,5,6,8}, Floor[f/t0]], f = f + t0 - 1; Continue[]];
        If[PrimeQ[f*t0 + IntegerReverse[Floor[f/10]]], c++]]; Return[c]];
    Table[A016115[n], {n, 1, 12}] (* Robert Price, May 25 2019 *)
  • PARI
    apply( {A016115(n)=if(n%2, (n<3)+vecsum([sum(k=i, i+n, (k*2-k%10)%3 && isprime(k*n+fromdigits(Vecrev(digits(k\10))))) | i<-[1, 3, 7, 9]*n=10^(n\2)]), n==2)}, [1..12]) \\ M. F. Hasler, Dec 19 2024
  • Python
    from sympy import isprime
    from itertools import product
    def pals(d, base=10): # all d-digit palindromes
        digits = "".join(str(i) for i in range(base))
        for p in product(digits, repeat=d//2):
            if d > 1 and p[0] == "0": continue
            left = "".join(p); right = left[::-1]
            for mid in [[""], digits][d%2]: yield int(left + mid + right)
    def a(n): return int(n==2) if n%2 == 0 else sum(isprime(p) for p in pals(n))
    print([a(n) for n in range(1, 13)]) # Michael S. Branicky, Jun 23 2021
    

Formula

a(2n) = 0 for n > 1. - Chai Wah Wu, Nov 21 2021

Extensions

Corrected and extended by Patrick De Geest, Jun 15 1998
a(17) = 27045226 was found by Martin Eibl (M.EIBL(AT)LINK-R.de) and independently by Warut Roonguthai and later confirmed by Carlos Rivera, in June 1998.
a(19) from Shyam Sunder Gupta, Feb 12 2006
a(21)-a(22) from Shyam Sunder Gupta, Mar 13 2009
a(23)-a(24) from Shyam Sunder Gupta, Oct 05 2013
a(25)-a(26) from Shyam Sunder Gupta, Dec 19 2024

A229875 Iterated sum-of-digits of palindromic prime; or digital root of palindromic prime.

Original entry on oeis.org

2, 3, 5, 7, 2, 2, 5, 7, 1, 2, 7, 2, 4, 5, 7, 1, 4, 5, 1, 2, 5, 7, 8, 7, 8, 1, 4, 5, 2, 7, 8, 4, 8, 7, 8, 5, 8, 1, 2, 2, 7, 1, 4, 5, 1, 2, 7, 8, 1, 4, 5, 8, 4, 4, 5, 8, 1, 4, 7, 8, 1, 5, 2, 5, 4, 7, 4, 5, 2, 8, 7, 1, 2, 1, 7, 2, 7, 2, 4, 8, 4, 2, 2, 2, 5, 4
Offset: 1

Views

Author

Shyam Sunder Gupta, Oct 02 2013

Keywords

Comments

Integers with digital root 3, 6 or 9 are divisible by 3, so 3 is the only palindromic prime with digital root 3 and there are no palindromic primes with digital root 6 or 9.

Examples

			a(7)=5 because the 7th palindromic prime is 131 and 1+3+1 = 5.
		

Crossrefs

Programs

  • Mathematica
    t = {}; Do[z = n*10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]; If[PrimeQ[z], AppendTo[t, Mod[z, 9]]], {n, 1, 99999}]; Insert[t, 2, 5]
    Mod[#,9]&/@Select[Prime[Range[9000]],PalindromeQ] (* Harvey P. Dale, Mar 25 2025 *)

Formula

a(n) = A010888(A002385(n)). - R. J. Mathar, Sep 09 2015

A256076 Non-palindromic balanced primes.

Original entry on oeis.org

1823, 1933, 2141, 2251, 2633, 2963, 3061, 3391, 4091, 4253, 4363, 4583, 5393, 5717, 5827, 6637, 6857, 6967, 7829, 8147, 8419, 8969, 9067, 9397, 14303, 14503, 15013, 15313, 15413, 15913, 16223, 16823, 17033, 17333, 18043, 18143, 18443, 18743, 19553, 19753, 19853
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Mar 14 2015

Keywords

Comments

Here a number is called balanced if the sum of digits weighted by their arithmetic distance from the "center" is zero. Palindromic primes (A002385) are "trivially" balanced, so they are excluded here.
These are the primes in A256075, see there for further information.
See A256081 for the binary version and A256090 for the hexadecimal version.

Examples

			a(1)=1823 is balanced because 1*3/2 + 8*1/2 = 2*1/2 + 3*3/2.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L,m;
      L:= convert(n,base,10);
      m:= (1+nops(L))/2;
    add(L[i]*(i-m),i=1..nops(L))=0  and isprime(n) and L <> ListTools:-Reverse(L)
    end proc:
    select(filter, [seq(i,i=1001..20000,2)]); # Robert Israel, May 29 2018
  • PARI
    is(n,d=digits(n),o=(#d+1)/2)=!(vector(#d,i,i-o)*d~)&&d!=Vecrev(d)&&isprime(n)

A045336 Palindromic terms from A019546.

Original entry on oeis.org

2, 3, 5, 7, 353, 373, 727, 757, 32323, 33533, 35353, 35753, 37273, 37573, 72227, 72727, 73237, 75557, 77377, 3222223, 3223223, 3233323, 3252523, 3272723, 3337333, 3353533, 3553553, 3722273, 3732373, 3773773, 7257527, 7327237, 7352537, 7527257, 7722277
Offset: 1

Views

Author

Robert G. Wilson v, Aug 18 2000

Keywords

Comments

a(33) = 7352537 is the smallest palindromic prime using all prime digits (see Prime Curios! link). - Bernard Schott, Nov 10 2020

Crossrefs

Cf. A019546 and A002385.

Programs

  • Mathematica
    Select[ Range[ 1, 10^7 ], PrimeQ[ # ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 0 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 1 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 4 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 6 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 8 ] && FreeQ[ RealDigits[ # ][ [ 1 ] ], 9 ] && RealDigits[ # ][ [ 1 ] ] == Reverse[ RealDigits[ # ][ [ 1 ] ] ] & ]
    Table[FromDigits/@Select[Tuples[{2,3,5,7},n],#==Reverse[#]&&PrimeQ[ FromDigits[ #]]&],{n,12}]//Flatten (* Harvey P. Dale, Jun 19 2016 *)
    Select[Flatten[Table[FromDigits/@Tuples[{2,3,5,7},n],{n,10}]],PrimeQ[#]&&PalindromeQ[#]&] (* Harvey P. Dale, Mar 24 2025 *)
    f@n_ := Prime@n;
    g@l_ := FromDigits@# & /@ Table[Join[l, {f@i}, Reverse@l], {i, 4}];
    Flatten[g@# & /@ (f@# & /@
         Select[Table[IntegerDigits[n, 5], {n, 2000}], FreeQ[#, 0] &])] //
    Select[PrimeQ] (* Hans Rudolf Widmer, Dec 18 2021 *)
  • Python
    from sympy import isprime
    from itertools import count, product, takewhile
    def primedigpals():
        for d in count(1, 2):
            for p in product("2357", repeat=d//2):
                left = "".join(p)
                for mid in "2357":
                    yield int(left + mid + left[::-1])
    def aupto(N):
        return list(takewhile(lambda x: x<=N, filter(isprime, primedigpals())))
    print(aupto(10**7)) # Michael S. Branicky, Dec 18 2021

A046368 Products of two palindromic primes.

Original entry on oeis.org

4, 6, 9, 10, 14, 15, 21, 22, 25, 33, 35, 49, 55, 77, 121, 202, 262, 302, 303, 362, 382, 393, 453, 505, 543, 573, 626, 655, 706, 707, 746, 755, 766, 905, 917, 939, 955, 1057, 1059, 1111, 1119, 1149, 1267, 1337, 1441, 1454, 1514, 1565, 1574, 1594, 1661, 1765, 1838, 1858
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Comments

Intersection of A001358 and A033620; A046368 is a subsequence. - Reinhard Zumkeller, Apr 10 2011
Equivalently, semiprimes where both prime factors are palindromes. - Franklin T. Adams-Watters, Apr 11 2011
See A046376 for the subsequence of palindromic terms. - M. F. Hasler, Jan 04 2022

Crossrefs

Cf. A001358 (semiprimes), A002113 (palindromes), A002385 (palindromic primes), A046376 (subsequence of palindromes), A046400.

Programs

  • Mathematica
    palQ[n_] := Reverse[x = IntegerDigits[n]] == x; Select[Range[1800], PrimeOmega[#] == 2 && And @@ palQ /@ First /@ FactorInteger[#] &] (* Jayanta Basu, Jun 23 2013 *)
  • PARI
    select( {is_A046368(n)=bigomega(n)==2 && vecmin( apply( is_A002113, factor(n)[, 1]))}, [1..9999]) \\ M. F. Hasler, Jan 04 2022

Extensions

Definition clarified by Franklin T. Adams-Watters, Apr 11 2011
Definition simplified by M. F. Hasler, Jan 04 2022
Previous Showing 21-30 of 287 results. Next