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 18 results. Next

A002385 Palindromic primes: prime numbers whose decimal expansion is a palindrome.

Original entry on oeis.org

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, 18481, 19391, 19891, 19991
Offset: 1

Views

Author

Keywords

Comments

Every palindrome with an even number of digits is divisible by 11, so 11 is the only member of the sequence with an even number of digits. - David Wasserman, Sep 09 2004
This holds in any number base A006093(n), n>1. - Lekraj Beedassy, Mar 07 2005 and Dec 06 2009
The log-log plot shows the fairly regular structure of these numbers. - T. D. Noe, Jul 09 2013
Conjecture: The only primes with palindromic prime indices that are palindromic primes themselves are 3, 5 and 11. Tested for the primes with the first 8000000 palindromic prime indices. - Ivan N. Ianakiev, Oct 10 2014
It follows from the above conjecture that 2 is the only k such that k, prime(k), prime(m) = k + prime(k) and m are all palindromic primes. - Ivan N. Ianakiev, Mar 17 2025
Banks, Hart, and Sakata derive a nontrivial upper bound for the number of prime palindromes n <= x as x -> oo. It follows that almost all palindromes are composite. The results hold in any base. The authors use Weil's bound for Kloosterman sums. - Jonathan Sondow, Jan 02 2018
Number of terms < 100^k, k >= 1: 5, 20, 113, 781, 5953, 47995, 401698, .... - Robert G. Wilson v, Jan 03 2018, corrected by M. F. Hasler, Dec 19 2024
Initially the above comment listed 4, 20, 113, ... which is the number of terms less than 10, 1000, 10^5, ..., i.e., up to 10^(2k-1), k >= 1. The number of terms < 10^k are the cumulative sums of A016115(n) (number of prime palindromes with n digits) up to n = k. - M. F. Hasler, Dec 19 2024

References

  • A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 228.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 120-121.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A007500 = this sequence union A006567.
Subsequence of A188650; A188649(a(n)) = a(n); see A033620 for multiplicative closure. [Reinhard Zumkeller, Apr 11 2011]
Cf. A016041, A029732, A069469, A117697, A046942, A032350 (Palindromic nonprime numbers).
Cf. A016115 (number of prime palindromes with n digits).

Programs

  • GAP
    Filtered([1..20000],n->IsPrime(n) and ListOfDigits(n)=Reversed(ListOfDigits(n))); # Muniru A Asiru, Mar 08 2019
  • Haskell
    a002385 n = a002385_list !! (n-1)
    a002385_list = filter ((== 1) . a136522) a000040_list
    -- Reinhard Zumkeller, Apr 11 2011
    
  • Maple
    ff := proc(n) local i,j,k,s,aa,nn,bb,flag; s := n; aa := convert(s,string); nn := length(aa); bb := ``; for i from nn by -1 to 1 do bb := cat(bb,substring(aa,i..i)); od; flag := 0; for j from 1 to nn do if substring(aa,j..j)<>substring(bb,j..j) then flag := 1 fi; od; RETURN(flag); end; gg := proc(i) if ff(ithprime(i)) = 0 then RETURN(ithprime(i)) fi end;
    rev:=proc(n) local nn, nnn: nn:=convert(n,base,10): add(nn[nops(nn)+1-j]*10^(j-1),j=1..nops(nn)) end: a:=proc(n) if n=rev(n) and isprime(n)=true then n else fi end: seq(a(n),n=1..20000); # rev is a Maple program to revert a number - Emeric Deutsch, Mar 25 2007
    # A002385 Gets all base-10 palindromic primes with exactly d digits, in the list "Res"
    d:=7; # (say)
    if d=1 then Res:= [2,3,5,7]:
    elif d=2 then Res:= [11]:
    elif d::even then
        Res:=[]:
    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)]:
        Res:=[]: for x in Res2 do if isprime(x) then Res:=[op(Res),x]; fi: od:
    fi:
    Res; # N. J. A. Sloane, Oct 18 2015
  • Mathematica
    Select[ Prime[ Range[2100] ], IntegerDigits[#] == Reverse[ IntegerDigits[#] ] & ]
    lst = {}; e = 3; Do[p = n*10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]; If[PrimeQ[p], AppendTo[lst, p]], {n, 10^e - 1}]; Insert[lst, 11, 5] (* Arkadiusz Wesolowski, May 04 2012 *)
    Join[{2,3,5,7,11},Flatten[Table[Select[Prime[Range[PrimePi[ 10^(2n)]+1, PrimePi[ 10^(2n+1)]]],# == IntegerReverse[#]&],{n,3}]]] (* The program uses the IntegerReverse function from Mathematica version 10 *) (* Harvey P. Dale, Apr 22 2016 *)
    genPal[n_Integer, base_Integer: 10] := Block[{id = IntegerDigits[n, base], insert = Join[{{}}, {# - 1} & /@ Range[base]]}, FromDigits[#, base] & /@ (Join[id, #, Reverse@id] & /@ insert)]; k = 1; lst = {2, 3, 5, 7}; While[k < 19, p = Select[genPal[k], PrimeQ];
    If[p != {}, AppendTo[lst, p]]; k++]; Flatten@ lst (* RGWv *)
    Select[ Prime[ Range[2100]], PalindromeQ] (* Jean-François Alcover, Feb 17 2018 *)
    NestList[NestWhile[NextPrime, #, ! PalindromeQ[#2] &, 2] &, 2, 41] (* Jan Mangaldan, Jul 01 2020 *)
  • PARI
    is(n)=n==eval(concat(Vecrev(Str(n))))&&isprime(n) \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    forprime(p=2,10^5, my(d=digits(p,10)); if(d==Vecrev(d),print1(p,", "))); \\ Joerg Arndt, Aug 17 2014
    
  • PARI
    A002385_row(n)=select(is_A002113, primes([10^(n-1),10^n])) \\ Terms with n digits. For larger n, better filter primes in palindromes. - M. F. Hasler, Dec 19 2024
    
  • Python
    from itertools import chain
    from sympy import isprime
    A002385 = sorted((n for n in chain((int(str(x)+str(x)[::-1]) for x in range(1,10**5)),(int(str(x)+str(x)[-2::-1]) for x in range(1,10**5))) if isprime(n))) # Chai Wah Wu, Aug 16 2014
    
  • Python
    from sympy import isprime
    A002385 = [*filter(isprime, (int(str(x) + str(x)[-2::-1]) for x in range(10**5)))]
    A002385.insert(4, 11)  # Yunhan Shi, Mar 03 2023
    
  • Python
    from sympy import isprime
    from itertools import count, islice, product
    def A002385gen(): # generator of palprimes
        yield from [2, 3, 5, 7, 11]
        for d in count(3, 2):
            for last in "1379":
                for p in product("0123456789", repeat=d//2-1):
                    left = "".join(p)
                    for mid in [[""], "0123456789"][d&1]:
                        t = int(last + left + mid + left[::-1] + last)
                        if isprime(t):
                            yield t
    print(list(islice(A002385gen(), 46))) # Michael S. Branicky, Apr 13 2025
    
  • Sage
    [n for n in (2..18181) if is_prime(n) and Word(n.digits()).is_palindrome()] # Peter Luschny, Sep 13 2018
    

Formula

Intersection of A000040 (primes) and A002113 (palindromes).
A010051(a(n)) * A136522(a(n)) = 1. [Reinhard Zumkeller, Apr 11 2011]
Complement of A032350 in A002113. - Jonathan Sondow, Jan 02 2018

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Oct 25 2000
Comment from A006093 moved here by Franklin T. Adams-Watters, Dec 03 2009

A051038 11-smooth numbers: numbers whose prime divisors are all <= 11.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 27, 28, 30, 32, 33, 35, 36, 40, 42, 44, 45, 48, 49, 50, 54, 55, 56, 60, 63, 64, 66, 70, 72, 75, 77, 80, 81, 84, 88, 90, 96, 98, 99, 100, 105, 108, 110, 112, 120, 121, 125, 126, 128, 132, 135, 140
Offset: 1

Views

Author

Keywords

Comments

A155182 is a finite subsequence. - Reinhard Zumkeller, Jan 21 2009
From Federico Provvedi, Jul 09 2022: (Start)
In general, if p=A000040(k) is the k-th prime, with k>1, p-smooth numbers are also those positive integers m such that A000010(A002110(k))*m == A000010(A002110(k)*m).
With k=5, p = A000040(5) = 11, the primorial p# = A002110(5) = 2310, and its Euler totient is A000010(2310) = 480, so the 11-smooth numbers are also those positive integers m such that 480*m == A000010(2310*m). (End)

Crossrefs

Subsequence of A033620.
For p-smooth numbers with other values of p, see A003586, A051037, A002473, A080197, A080681, A080682, A080683.

Programs

  • Magma
    [n: n in [1..150] | PrimeDivisors(n) subset PrimesUpTo(11)]; // Bruno Berselli, Sep 24 2012
    
  • Mathematica
    mx = 150; Sort@ Flatten@ Table[ 2^i*3^j*5^k*7^l*11^m, {i, 0, Log[2, mx]}, {j, 0, Log[3, mx/2^i]}, {k, 0, Log[5, mx/(2^i*3^j)]}, {l, 0, Log[7, mx/(2^i*3^j*5^k)]}, {m, 0, Log[11, mx/(2^i*3^j*5^k*7^l)]}] (* Robert G. Wilson v, Aug 17 2012 *)
    aQ[n_]:=Max[First/@FactorInteger[n]]<=11; Select[Range[140],aQ[#]&] (* Jayanta Basu, Jun 05 2013 *)
    Block[{k=5,primorial:=Times@@Prime@Range@#&},Select[Range@200,#*EulerPhi@primorial@k==EulerPhi[#*primorial@k]&]] (* Federico Provvedi, Jul 09 2022 *)
  • PARI
    test(n)=m=n; forprime(p=2,11, while(m%p==0,m=m/p)); return(m==1)
    for(n=1,200,if(test(n),print1(n",")))
    
  • PARI
    list(lim,p=11)=if(p==2, return(powers(2, logint(lim\1,2)))); my(v=[],q=precprime(p-1),t=1); for(e=0,logint(lim\=1,p), v=concat(v, list(lim\t,q)*t); t*=p); Set(v) \\ Charles R Greathouse IV, Apr 16 2020
    
  • Python
    import heapq
    from itertools import islice
    from sympy import primerange
    def agen(p=11): # generate all p-smooth terms
        v, oldv, h, psmooth_primes, = 1, 0, [1], list(primerange(1, p+1))
        while True:
            v = heapq.heappop(h)
            if v != oldv:
                yield v
                oldv = v
                for p in psmooth_primes:
                    heapq.heappush(h, v*p)
    print(list(islice(agen(), 67))) # Michael S. Branicky, Nov 20 2022
    
  • Python
    from sympy import integer_log, prevprime
    def A051038(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def g(x,m): return sum((x//3**i).bit_length() for i in range(integer_log(x,3)[0]+1)) if m==3 else sum(g(x//(m**i),prevprime(m))for i in range(integer_log(x,m)[0]+1))
        def f(x): return n+x-g(x,11)
        return bisection(f,n,n) # Chai Wah Wu, Sep 16 2024

Formula

Sum_{n>=1} 1/a(n) = Product_{primes p <= 11} p/(p-1) = (2*3*5*7*11)/(1*2*4*6*10) = 77/16. - Amiram Eldar, Sep 22 2020

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

A046351 Palindromic composite numbers with only palindromic prime factors.

Original entry on oeis.org

4, 6, 8, 9, 22, 33, 44, 55, 66, 77, 88, 99, 121, 202, 242, 252, 262, 303, 343, 363, 393, 404, 484, 505, 525, 606, 616, 626, 686, 707, 808, 909, 939, 1111, 1331, 1441, 1661, 1991, 2112, 2222, 2662, 2772, 2882, 3333, 3443, 3773, 3883, 3993, 4224, 4444, 5445
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Programs

  • Mathematica
    palQ[n_]:=Reverse[x=IntegerDigits[n]]==x; Select[Range[4,5500],!PrimeQ[#]&&And@@palQ/@Join[{#},First/@FactorInteger[#]]&](* Jayanta Basu, Jun 05 2013 *)
  • Python
    from itertools import product
    from sympy import isprime, primefactors as pf
    def pal(n): s = str(n); return s == s[::-1]
    def palsthru(maxdigits):
      midrange = [[""], [str(i) for i in range(10)]]
      for digits in range(1, maxdigits+1):
        for p in product("0123456789", repeat=digits//2):
          left = "".join(p)
          if len(left) and left[0] == '0': continue
          for middle in midrange[digits%2]: yield int(left+middle+left[::-1])
    def okpal(p): return p > 3 and not isprime(p) and all(pal(f) for f in pf(p))
    print(list(filter(okpal, palsthru(4)))) # Michael S. Branicky, Apr 06 2021

Formula

(A032350 INTERSECT A033620) MINUS {1}. - R. J. Mathar, Sep 09 2015

A046349 Composite numbers with only palindromic prime factors.

Original entry on oeis.org

4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 27, 28, 30, 32, 33, 35, 36, 40, 42, 44, 45, 48, 49, 50, 54, 55, 56, 60, 63, 64, 66, 70, 72, 75, 77, 80, 81, 84, 88, 90, 96, 98, 99, 100, 105, 108, 110, 112, 120, 121, 125, 126, 128, 132, 135, 140, 144, 147, 150
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Programs

  • Maple
    isA046349 := proc(n)
        simplify(isA033620(n) and not isprime(n)) ;
    end proc:
    for n from 2 to 300 do
        if isA046349(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Sep 09 2015
  • Mathematica
    palQ[n_]:=Reverse[x=IntegerDigits[n]]==x; Select[Range[4,150],!PrimeQ[#]&&And@@palQ/@First/@FactorInteger[#]&] (* Jayanta Basu, Jun 05 2013 *)
    Select[Range[200],CompositeQ[#]&&AllTrue[FactorInteger[#][[All,1]],PalindromeQ]&] (* Harvey P. Dale, May 15 2022 *)
  • Python
    from sympy import isprime, primefactors
    def pal(n): s = str(n); return s == s[::-1]
    def ok(n): return not isprime(n) and all(pal(f) for f in primefactors(n))
    print(list(filter(ok, range(4, 151)))) # Michael S. Branicky, Apr 06 2021

Formula

A033620 INTERSECT A002808. - R. J. Mathar, Sep 09 2015

A046402 Numbers with exactly 4 distinct palindromic prime factors.

Original entry on oeis.org

210, 330, 462, 770, 1155, 3030, 3930, 4242, 4530, 5430, 5502, 5730, 6342, 6666, 7070, 7602, 8022, 8646, 9170, 9390, 9966, 10570, 10590, 10605, 11110, 11190, 11490, 11946, 12606, 12670, 13146, 13370, 13755, 14410, 14826, 15554, 15666, 15855, 16086, 16610, 16665
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Intersection of A033620 and A046386.
Cf. A046370.

Programs

  • Mathematica
    Take[Times@@@Module[{nn=300,pp},pp=Select[Prime[Range[nn]],PalindromeQ];Subsets[pp,{4}]]//Union,40] (* Harvey P. Dale, Aug 13 2024 *)

Extensions

Offset changed and a(37) onwards from Andrew Howroyd, Aug 14 2024

A046404 Odd numbers with exactly 2 distinct palindromic prime factors.

Original entry on oeis.org

15, 21, 33, 35, 55, 77, 303, 393, 453, 505, 543, 573, 655, 707, 755, 905, 917, 939, 955, 1057, 1059, 1111, 1119, 1149, 1267, 1337, 1441, 1565, 1661, 1765, 1865, 1915, 1991, 2101, 2181, 2191, 2271, 2361, 2391, 2471, 2611, 2681, 2757, 2787, 3443, 3635, 3785
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Intersection of A033620 and A046388.
Cf. A046372.

Programs

  • Mathematica
    dpf2Q[n_]:=Module[{pfs=Transpose[FactorInteger[n]][[1]],a,b},a=First[pfs];b=Last[pfs];PrimeNu[n]==PrimeOmega[n]==2 && a==FromDigits[Reverse[ IntegerDigits[ a]]] && b==FromDigits[Reverse[ IntegerDigits[b]]]]; Select[ Range[1,3801,2],dpf2Q] (* Harvey P. Dale, Jul 14 2013 *)

Extensions

Offset changed by Andrew Howroyd, Aug 14 2024

A046405 Numbers of the form p*q*r where p,q,r are distinct odd palindromic primes (odd terms from A002385).

Original entry on oeis.org

105, 165, 231, 385, 1515, 1965, 2121, 2265, 2715, 2751, 2865, 3171, 3333, 3535, 3801, 4011, 4323, 4585, 4695, 4983, 5285, 5295, 5555, 5595, 5745, 5973, 6303, 6335, 6573, 6685, 7205, 7413, 7777, 7833, 8043, 8305, 9955, 10087, 10329, 10505, 10905
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Intersection of A033620 and A046389.

Extensions

Definition clarified by N. J. A. Sloane, Dec 19 2017 at the suggestion of Harvey P. Dale
Offset changed by Andrew Howroyd, Aug 14 2024

A046350 Odd composite numbers with only palindromic prime factors.

Original entry on oeis.org

9, 15, 21, 25, 27, 33, 35, 45, 49, 55, 63, 75, 77, 81, 99, 105, 121, 125, 135, 147, 165, 175, 189, 225, 231, 243, 245, 275, 297, 303, 315, 343, 363, 375, 385, 393, 405, 441, 453, 495, 505, 525, 539, 543, 567, 573, 605, 625, 655, 675, 693, 707, 729, 735, 755
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Programs

  • Mathematica
    palQ[n_]:=Reverse[x=IntegerDigits[n]]==x; Select[Range[9,755,2],!PrimeQ[#]&&And@@palQ/@First/@FactorInteger[#]&] (* Jayanta Basu, Jun 05 2013 *)
    Select[Range[9,800,2],CompositeQ[#]&&AllTrue[FactorInteger[#][[All,1]], PalindromeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Mar 08 2018 *)
  • Python
    from sympy import isprime, primefactors
    def pal(n): s = str(n); return s == s[::-1]
    def ok(n): return not isprime(n) and all(pal(f) for f in primefactors(n))
    print(list(filter(ok, range(9, 756, 2)))) # Michael S. Branicky, Apr 06 2021

A046406 Odd numbers with exactly 4 distinct palindromic prime factors.

Original entry on oeis.org

1155, 10605, 13755, 15855, 16665, 19005, 20055, 21615, 23331, 24915, 29865, 30261, 31515, 32865, 34881, 37065, 38885, 39165, 40215, 41811, 44121, 50435, 51645, 58135, 58245, 61545, 63195, 69685, 72303, 73535, 76335, 79485, 81543
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Intersection of A033620 and A046390.
Cf. A046374.

Extensions

Offset changed by Andrew Howroyd, Aug 14 2024
Showing 1-10 of 18 results. Next