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

A188650 Fixed points of A188649: numbers divisible by the reverse of all their divisors.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 22, 33, 40, 44, 55, 66, 77, 88, 99, 101, 110, 121, 131, 151, 181, 191, 202, 220, 242, 262, 303, 313, 353, 363, 373, 383, 393, 404, 440, 484, 505, 606, 626, 707, 727, 757, 787, 797, 808, 909, 919, 929, 939, 1010, 1111, 1331, 1441, 1661, 1991, 2020, 2222, 2662, 2882, 3333, 3443, 3883, 3993, 4040, 4444, 5555, 6666, 6886, 7777, 7997, 8888
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 11 2011

Keywords

Comments

A188649(a(n)) = a(n);
A002385 and A046376 are subsequences; subsequence of A002113.

Programs

  • Haskell
    import Data.List (elemIndices)
    a188650 n = a188650_list !! (n-1)
    a188650_list =
       map succ $ elemIndices 0 $ zipWith (-) [1..] $ map a188649 [1..]
    
  • PARI
    rev(n:int,B=10)=my(m=n%B);n\=B;while(n>0,m=m*B+n%B;n\=B);m
    is(n)=fordiv(n,d,if(n%rev(d),return(0)));1 \\ Charles R Greathouse IV, Jul 14 2011
    
  • Python
    from math import lcm
    from sympy import divisors
    def ok(n): return n == lcm(*(int(str(d)[::-1]) for d in divisors(n)))
    print([k for k in range(1, 10000) if ok(k)]) # Michael S. Branicky, Sep 30 2022

A004086 Read n backwards (referred to as R(n) in many sequences).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 2, 12, 22, 32, 42, 52, 62, 72, 82, 92, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 6, 16, 26, 36, 46, 56, 66, 76, 86, 96, 7, 17, 27, 37, 47
Offset: 0

Views

Author

Keywords

Comments

Also called digit reversal of n.
Leading zeros (after the reversal has taken place) are omitted. - N. J. A. Sloane, Jan 23 2017

Crossrefs

Programs

  • Haskell
    a004086 = read . reverse . show  -- Reinhard Zumkeller, Apr 11 2011
    
  • J
    |.&.": i.@- 1e5 NB. Stephen Makdisi, May 14 2018
  • Maple
    read transforms; A004086 := digrev; #cf "Transforms" link at bottom of page
    A004086:=proc(n) local s,t; if n<10 then n else s:=irem(n,10,'t'); while t>9 do s:=s*10+irem(t,10,'t') od: s*10+t fi end; # M. F. Hasler, Jan 29 2012
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[n]]], {n, 0, 75}]
    IntegerReverse[Range[0,80]](* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 13 2018 *)
  • PARI
    dig(n) = {local(m=n,r=[]); while(m>0,r=concat(m%10,r);m=floor(m/10));r}
    A004086(n) = {local(b,m,r);r=0;b=1;m=dig(n);for(i=1,matsize(m)[2],r=r+b*m[i];b=b*10);r} \\ Michael B. Porter, Oct 16 2009
    
  • PARI
    A004086(n)=fromdigits(Vecrev(digits(n))) \\ M. F. Hasler, Nov 11 2010, updated May 11 2015, Sep 13 2019
    
  • Python
    def A004086(n):
        return int(str(n)[::-1]) # Chai Wah Wu, Aug 30 2014
    

Formula

For n > 0, a(a(n)) = n iff n mod 10 != 0. - Reinhard Zumkeller, Mar 10 2002
a(n) = d(n,0) with d(n,r) = r if n=0, otherwise d(floor(n/10), r*10+(n mod 10)). - Reinhard Zumkeller, Mar 04 2010
a(10*n+x) = x*10^m + a(n) if 10^(m-1) <= n < 10^m and 0 <= x <= 9. - Robert Israel, Jun 11 2015

Extensions

Extended by Ray Chandler, Dec 30 2004

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

A004087 Primes written backwards.

Original entry on oeis.org

2, 3, 5, 7, 11, 31, 71, 91, 32, 92, 13, 73, 14, 34, 74, 35, 95, 16, 76, 17, 37, 97, 38, 98, 79, 101, 301, 701, 901, 311, 721, 131, 731, 931, 941, 151, 751, 361, 761, 371, 971, 181, 191, 391, 791, 991, 112, 322, 722, 922, 332, 932, 142, 152, 752, 362, 962, 172
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A000040.

Programs

  • Haskell
    a004087 n = a004087_list !! (n-1)
    a004087_list = map a004086 a000040_list
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Magma
    [Seqint(Reverse(Intseq(NthPrime(n)))): n in [1..60]]; // Vincenzo Librandi, Jan 21 2016
    
  • Mathematica
    FromDigits[Reverse[IntegerDigits[#]]]&/@Prime[Range[100]] (* Vincenzo Librandi, Jul 05 2015 *)
  • Python
    from sympy import primerange
    print([int(str(p)[::-1]) for p in primerange(2, 272)]) # Michael S. Branicky, Jun 24 2022

Formula

a(n) = A004086(A000040(n)) = A000040(n) - A068396(n). - N. J. A. Sloane, Jun 29 2008
a(n) = A188649(A000040(n)). - Reinhard Zumkeller, Apr 11 2011
a(n) = A071786(A000040(n)). - Reinhard Zumkeller, Oct 14 2011

Extensions

More terms from Eric M. Schmidt, Apr 04 2014

A046376 Palindromes with exactly 2 palindromic prime factors (counted with multiplicity), and no other prime factors.

Original entry on oeis.org

4, 6, 9, 22, 33, 55, 77, 121, 202, 262, 303, 393, 505, 626, 707, 939, 1111, 1441, 1661, 1991, 3443, 3883, 7997, 10201, 13231, 15251, 18281, 19291, 20602, 22622, 22822, 24842, 26662, 28682, 30903, 31613, 33933, 35653, 37673, 38683, 39993, 60206, 60406, 60806
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Comments

Equivalently, semiprime palindromes where both prime factors are palindromes. - Franklin T. Adams-Watters, Apr 11 2011
The sequence "trivially" includes products of palindromic primes p*q where
a) p = 2 or 3 and q has only digits < 4, as q = 11, 101, 131, 10301, 30103, ...
b) p <= 11 and q has only digits 0 and 1, as q = 101 and repunit primes A004022
c) p = 11 and q has only digits spaced out by zeros, as q = 101, 10301, 10501, 10601, 30103, 30203, 30403, 30703, 30803, ... - M. F. Hasler, Jan 04 2022

Examples

			The palindrome 35653 is a term since it has 2 factors, 101 and 353, both palindromic.
		

Crossrefs

Cf. A001358 (semiprimes), A002113 (palindromes), A002385 (palindromic primes).
Subsequence of A188650.

Programs

  • Mathematica
    Take[Select[Times@@@Tuples[Select[Prime[Range[5000]],PalindromeQ],2], PalindromeQ]// Union,50] (* Harvey P. Dale, Aug 25 2019 *)
  • PARI
    {first(N=50, p=1) = vector(N, i, until( bigomega( p=nxt_A002113(p))==2 && vecmin( apply( is_A002113, factor(p)[,1])),); p)} \\ M. F. Hasler, Jan 04 2022
    
  • Python
    from sympy import factorint
    from itertools import product
    def ispal(n): s = str(n); return s == s[::-1]
    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 ok(pal):
        f = factorint(pal)
        return sum(f.values()) == 2 and all(ispal(p) for p in f)
    print(list(filter(ok, (p for d in range(1, 6) for p in pals(d) if ok(p))))) # Michael S. Branicky, Aug 14 2022

Formula

Intersection of A002113 and A046368; A188649(a(n)) = a(n). - Reinhard Zumkeller, Apr 11 2011

Extensions

Definition clarified by Franklin T. Adams-Watters, Apr 11 2011
More terms from Lars Blomberg, Nov 06 2015
Showing 1-5 of 5 results.