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 41-50 of 829 results. Next

A029804 Numbers that are palindromic in bases 8 and 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 121, 292, 333, 373, 414, 585, 3663, 8778, 13131, 13331, 26462, 26662, 30103, 30303, 207702, 628826, 660066, 1496941, 1935391, 1970791, 4198914, 55366355, 130535031, 532898235, 719848917, 799535997, 1820330281
Offset: 1

Views

Author

Keywords

Comments

Intersection of A002113 and A029803. - Michel Marcus, Nov 20 2014

Crossrefs

Programs

  • Magma
    [n: n in [0..10000000] | Intseq(n, 10) eq Reverse(Intseq(n, 10))and Intseq(n, 8) eq Reverse(Intseq(n, 8))]; // Vincenzo Librandi, Nov 23 2014
    
  • Mathematica
    b1=8; b2=10; lst={}; Do[d1=IntegerDigits[n, b1];d2=IntegerDigits[n,b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 100000}]; lst (* Vincenzo Librandi, Nov 13 2014 *)
    Select[Range[0,1820331000],PalindromeQ[#]&&IntegerDigits[#,8] == Reverse[ IntegerDigits[#,8]]&] (* Harvey P. Dale, Mar 18 2019 *)
  • PARI
    isok(n) = (n==0) || ((d10=digits(n, 10)) && (d10==Vecrev(d10)) && (d8=digits(n, 8)) && (d8==Vecrev(d8))); \\ Michel Marcus, Nov 13 2014
    
  • PARI
    ispal(n,r) = my(d=digits(n,r)); d==Vecrev(d);
    for(n=0,10^7,if(ispal(n,10)&&ispal(n,8),print1(n,", "))); \\ Joerg Arndt, Nov 22 2014
    
  • Python
    def palQ8(n): # check if n is a palindrome in base 8
        s = oct(n)[2:]
        return s == s[::-1]
    def palQgen10(l): # unordered generator of palindromes of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1,10**l):
                s = str(x)
                yield int(s+s[-2::-1])
                yield int(s+s[::-1])
    A029804_list = sorted([n for n in palQgen10(6) if palQ8(n)])
    # Chai Wah Wu, Nov 25 2014

Extensions

More terms from Robert G. Wilson v, Sep 30 2004
Incorrect Mathematica program deleted by N. J. A. Sloane, Sep 01 2009
Terms 33 through 36 corrected by Rick Regan (exploringbinary(AT)gmail.com), Sep 01 2009

A029742 Nonpalindromic numbers.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 102, 103, 104, 105, 106, 107
Offset: 1

Views

Author

Keywords

Comments

Complement of A002113; A136522(a(n)) = 0.
A064834(a(n)) > 0. - Reinhard Zumkeller, Sep 18 2013

Crossrefs

Cf. A002113. Different from A031955.

Programs

  • Haskell
    a029742 n = a029742_list !! (n-1)
    a029742_list = filter ((== 0) . a136522) [1..]
    -- Reinhard Zumkeller, Oct 09 2011
    
  • Magma
    [n: n in [0..150] | Intseq(n) ne Reverse(Intseq(n))]; // Bruno Berselli, Apr 01 2015
    
  • Mathematica
    palQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn]]; DeleteCases[ Range[10,110],?palQ] (* _Harvey P. Dale, Jan 28 2012 *)
    Table[If[PalindromeQ[n],Nothing,n],{n,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 13 2019 *)
  • PARI
    is(n)=my(d=digits(n)); d!=Vecrev(d) \\ Charles R Greathouse IV, Feb 06 2017
    
  • Python
    def ok(n): s = str(n); return s != s[::-1]
    print(list(filter(ok, range(108)))) # Michael S. Branicky, Oct 12 2021
    
  • Python
    def A029742(n):
        def f(x): return n+x//10**((l:=len(s:=str(x)))-(k:=l+1>>1))-(int(s[k-1::-1])>x%10**k)+10**(k-1+(l&1^1))-1
        m, k = n, f(n)
        while m != k:
            m, k = k, f(k)
        return m # Chai Wah Wu, Jul 24 2024

Extensions

Offset corrected by Reinhard Zumkeller, Oct 09 2011

A029803 Numbers that are palindromic in base 8.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 18, 27, 36, 45, 54, 63, 65, 73, 81, 89, 97, 105, 113, 121, 130, 138, 146, 154, 162, 170, 178, 186, 195, 203, 211, 219, 227, 235, 243, 251, 260, 268, 276, 284, 292, 300, 308, 316, 325, 333, 341, 349, 357, 365, 373, 381, 390, 398
Offset: 1

Views

Author

Keywords

Comments

Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020

Crossrefs

Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,8], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
  • PARI
    ispal(n,b=8)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
    
  • Python
    from itertools import chain, count, islice
    def A029803_gen(): # generator of terms
        return chain((0,),chain.from_iterable(chain((int((s:=oct(d)[2:])+s[-2::-1],8) for d in range(8**l,8**(l+1))), (int((s:=oct(d)[2:])+s[::-1],8) for d in range(8**l,8**(l+1)))) for l in count(0)))
    A029803_list = list(islice(A029803_gen(),20)) # Chai Wah Wu, Jun 23 2022
    
  • Python
    def A029803(n):
        if n == 1: return 0
        y = (x:=1<<(m:=n.bit_length()-2)-m%3)<<3
        return (c:=n-x)*x+int(oct(c)[-2:1:-1]or'0',8) if nChai Wah Wu, Jun 13 2024

Formula

Sum_{n>=2} 1/a(n) = 3.2188878... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020

A029955 Palindromic in base 9.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 20, 30, 40, 50, 60, 70, 80, 82, 91, 100, 109, 118, 127, 136, 145, 154, 164, 173, 182, 191, 200, 209, 218, 227, 236, 246, 255, 264, 273, 282, 291, 300, 309, 318, 328, 337, 346, 355, 364, 373, 382, 391, 400, 410, 419, 428, 437
Offset: 1

Views

Author

Keywords

Comments

Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020

Crossrefs

Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,9], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
  • PARI
    ispal(n,b=9)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
  • Python
    from gmpy2 import digits
    def palQgen(l,b): # generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1,l+1):
                for y in range(b**(x-1),b**x):
                    s = digits(y,b)
                    yield int(s+s[-2::-1],b)
                for y in range(b**(x-1),b**x):
                    s = digits(y,b)
                    yield int(s+s[::-1],b)
    A029955_list = list(palQgen(4,9)) # Chai Wah Wu, Dec 01 2014
    
  • Python
    from gmpy2 import digits
    def A029955(n):
        if n == 1: return 0
        y = 9*(x:=9**(len(digits(n>>1,9))-1))
        return int((c:=n-x)*x+int(digits(c,9)[-2::-1]or'0',9) if nChai Wah Wu, Jun 14 2024
    

Formula

Sum_{n>=2} 1/a(n) = 3.29797695... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020

A033665 Number of 'Reverse and Add' steps needed to reach a palindrome starting at n, or -1 if n never reaches a palindrome.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 0, 1, 2, 1, 2, 2, 1, 1, 1, 1, 1, 0, 1, 2, 2, 3, 1, 1, 1, 1, 2, 1, 0, 2, 3, 4, 1, 1, 1, 2, 1, 2, 2, 0, 4, 6, 1, 1, 2, 1, 2, 2, 3, 4, 0, 24, 1, 2, 1, 2, 2, 3, 4, 6, 24, 0, 1, 0, 1, 1
Offset: 0

Views

Author

Keywords

Comments

Palindromes themselves are not 'Reverse and Add!'ed, so they yield a zero!
Numbers n that may have a(n) = -1 (i.e., potential Lychrel numbers) appear in A023108. - Michael De Vlieger, Jan 11 2018
Record indices and values are given in A065198 and A065199. - M. F. Hasler, Feb 16 2020

Examples

			19 -> 19+91 = 110 -> 110+011 = 121 = palindrome, took 2 steps, so a(19)=2.
n = 89 needs 24 steps to end up with the palindrome 8813200023188. See A240510. - _Wolfdieter Lang_, Jan 12 2018
		

References

  • D. Wells, The Penguin Dictionary of Curious and Interesting Numbers Penguin Books, 1987, pp. 142-143.

Crossrefs

Equals A030547(n) - 1.
Cf. A065198, A065199 (record indices & values).

Programs

  • Mathematica
    rev[n_]:=FromDigits[Reverse[IntegerDigits[n]]];radd[n_]:=n+rev[n];
    pal[n_]:=If[n==rev[n],True,False];
    raddN[n_]:=Length[NestWhileList[radd[#]&,n,pal[#]==False&]]-1;
    raddN/@Range[0,195] (* Ivan N. Ianakiev, Aug 31 2015 *)
    With[{nn = 10^3}, Array[-1 + Length@ NestWhileList[# + IntegerReverse@ # &, #, !PalindromeQ@ # &, 1, nn] /. k_ /; k == nn -> -1 &, 200]] (* Michael De Vlieger, Jan 11 2018 *)
  • PARI
    rev(n)={d=digits(n);p="";for(i=1,#d,p=concat(Str(d[i]),p));return(eval(p))}
    a(n)=if(n==rev(n),return(0));for(k=1,10^3,i=n+rev(n);if(rev(i)==i,return(k));n=i)
    n=0;while(n<100,print1(a(n),", ");n++) \\ Derek Orr, Jul 28 2014
    
  • PARI
    A033665(n,LIM=333)={-!for(i=0,LIM,my(r=A004086(n)); n==r&&return(i); n+=r)} \\ with {A004086(n)=fromdigits(Vecrev(digits(n)))}. The second optional arg is a search limit that could be taken smaller up to very large n, e.g., 99 for n < 10^9, 200 for n < 10^14, 250 for n < 10^18: see A065199 for the records and A065198 for the n's. - M. F. Hasler, Apr 13 2019, edited Feb 16 2020
    
  • Python
    A033665 = lambda n, LIM=333: next((i for i in range(LIM) if is_A002113(n) or not(n := A004086(n)+n)), -1) # The second, optional argument is a search limit, see above. - M. F. Hasler, May 23 2024

Extensions

More terms from Patrick De Geest, Jun 15 1998
I truncated the b-file at n=195, since the value of a(196) is not presently known (cf. A006960). The old b-files are now a-files. - N. J. A. Sloane, May 09 2015

A014192 Palindromes in base 4 (written in base 10).

Original entry on oeis.org

0, 1, 2, 3, 5, 10, 15, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 63, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 257, 273, 289, 305, 325, 341, 357, 373, 393, 409, 425, 441, 461, 477, 493, 509, 514, 530, 546, 562, 582, 598, 614, 630, 650, 666
Offset: 1

Views

Author

Keywords

Comments

Rajasekaran, Shallit, & Smith prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020

Crossrefs

Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Magma
    [n: n in [0..800] | Intseq(n, 4) eq Reverse(Intseq(n, 4))]; // Vincenzo Librandi, Sep 09 2015
    
  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,4], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
    pal4Q[n_]:=Module[{c=IntegerDigits[n,4]},c==Reverse[c]]; Select[Range[ 0,700],pal4Q] (* Harvey P. Dale, Jul 21 2020 *)
  • PARI
    ispal(n,b=4)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
    
  • Python
    from gmpy2 import digits
    def A014192(n):
        if n == 1: return 0
        y = (x:=1<<(n.bit_length()-2&-2))<<2
        return (c:=n-x)*x+int(digits(c,4)[-2::-1]or'0',4) if nChai Wah Wu, Jun 14 2024

Formula

Sum_{n>=2} 1/a(n) = 2.7857715... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020

Extensions

More terms from Patrick De Geest

A057148 Palindromes only using 0 and 1 (i.e., base-2 palindromes).

Original entry on oeis.org

0, 1, 11, 101, 111, 1001, 1111, 10001, 10101, 11011, 11111, 100001, 101101, 110011, 111111, 1000001, 1001001, 1010101, 1011101, 1100011, 1101011, 1110111, 1111111, 10000001, 10011001, 10100101, 10111101, 11000011, 11011011, 11100111, 11111111, 100000001
Offset: 1

Views

Author

Henry Bottomley, Aug 14 2000

Keywords

Comments

For each term having fewer than 10 digits, the square will also be a palindrome. - Dmitry Kamenetsky, Oct 21 2008

Crossrefs

Cf. A006995 for sequence translated from binary to decimal. A016116 for number of terms of sequence with n+1 binary digits (0 taken to have no digits).

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *)
    Select[ NestList[ NextPalindrome, 0, 11110], Max(AT) IntegerDigits(AT)# < 2 &] (* Robert G. Wilson v *)
    Select[FromDigits/@Tuples[{0,1},8],IntegerDigits[#]==Reverse[ IntegerDigits[ #]]&] (* Harvey P. Dale, Apr 20 2015 *)
  • Python
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield from [0, 1]
        for d in count(2):
            for rest in product("01", repeat=d//2-1):
                left = "1" + "".join(rest)
                for mid in [[""], ["0", "1"]][d%2]:
                    yield int(left + mid + left[::-1])
    print(list(islice(agen(), 32))) # Michael S. Branicky, Mar 29 2022
    
  • Python
    def A057148(n):
        if n == 1: return 0
        a = 1<Chai Wah Wu, Jun 10 2024
  • Sage
    [int(n.binary()) for n in (0..220) if Word(n.digits(2)).is_palindrome()] # Peter Luschny, Sep 13 2018
    

A029952 Palindromic in base 5.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 12, 18, 24, 26, 31, 36, 41, 46, 52, 57, 62, 67, 72, 78, 83, 88, 93, 98, 104, 109, 114, 119, 124, 126, 156, 186, 216, 246, 252, 282, 312, 342, 372, 378, 408, 438, 468, 498, 504, 534, 564, 594, 624, 626, 651, 676, 701, 726, 756, 781, 806, 831
Offset: 1

Views

Author

Keywords

Comments

Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020

Crossrefs

Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Magma
    [n: n in [0..900] | Intseq(n, 5) eq Reverse(Intseq(n, 5))]; // Vincenzo Librandi, Sep 09 2015
    
  • Maple
    # test for palindrome in base b, from N. J. A. Sloane, Sep 13 2015
    b:=5;
    ispal := proc(n) global b; local t1,t2,i;
    if n <= b-1 then return(1); fi;
    t1:=convert(n,base,b); t2:=nops(t1);
    for i from 1 to floor(t2/2) do
    if t1[i] <> t1[t2+1-1] then return(-1); fi;
    od: return(1); end;
    lis:=[]; for n from 0 to 100 do if ispal(n) = 1 then lis:=[op(lis),n]; fi; od: lis;
  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,5], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
    Select[Range[0,1000],IntegerDigits[#,5]==Reverse[IntegerDigits[#,5]]&] (* Harvey P. Dale, Oct 24 2020 *)
  • PARI
    ispal(n,b=5)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
    
  • Python
    from gmpy2 import digits
    def A029952(n):
        if n == 1: return 0
        y = 5*(x:=5**(len(digits(n>>1,5))-1))
        return int((c:=n-x)*x+int(digits(c,5)[-2::-1]or'0',5) if nChai Wah Wu, Jun 13 2024

Formula

Sum_{n>=2} 1/a(n) = 2.9200482... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020

A029954 Palindromic in base 7.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 16, 24, 32, 40, 48, 50, 57, 64, 71, 78, 85, 92, 100, 107, 114, 121, 128, 135, 142, 150, 157, 164, 171, 178, 185, 192, 200, 207, 214, 221, 228, 235, 242, 250, 257, 264, 271, 278, 285, 292, 300, 307, 314, 321, 328, 335, 342, 344, 400, 456
Offset: 1

Views

Author

Keywords

Comments

Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020

Crossrefs

Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,7], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
    pal7Q[n_]:=Module[{idn7=IntegerDigits[n,7]},idn7==Reverse[idn7]]; Select[ Range[0,500],pal7Q] (* Harvey P. Dale, Jul 30 2015 *)
  • PARI
    ispal(n,b=7)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
  • Python
    from gmpy2 import digits
    def palQgen(l,b): # generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1,l+1):
                for y in range(b**(x-1),b**x):
                    s = digits(y,b)
                    yield int(s+s[-2::-1],b)
                for y in range(b**(x-1),b**x):
                    s = digits(y,b)
                    yield int(s+s[::-1],b)
    A029954_list = list(palQgen(4,7)) # Chai Wah Wu, Dec 01 2014
    
  • Python
    from gmpy2 import digits
    from sympy import integer_log
    def A029954(n):
        if n == 1: return 0
        y = 7*(x:=7**integer_log(n>>1,7)[0])
        return int((c:=n-x)*x+int(digits(c,7)[-2::-1]or'0',7) if nChai Wah Wu, Jun 14 2024
    

Formula

Sum_{n>=2} 1/a(n) = 3.1313768... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020

A003098 Palindromic triangular numbers.

Original entry on oeis.org

0, 1, 3, 6, 55, 66, 171, 595, 666, 3003, 5995, 8778, 15051, 66066, 617716, 828828, 1269621, 1680861, 3544453, 5073705, 5676765, 6295926, 35133153, 61477416, 178727871, 1264114621, 1634004361, 5289009825, 6172882716, 13953435931
Offset: 1

Views

Author

Keywords

Comments

The only known terms with an even number 2*m of digits that are the concatenation of two palindromes with m digits are 55, 66 and 828828 (see David Wells entry 828828). - Bernard Schott, Apr 29 2022

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Charles W. Trigg, Palindromic Triangular Numbers, J. Rec. Math., 6 (1973), 146-147.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, p. 73 and p. 178, entry 828828 (Rev. ed. 1997)

Crossrefs

Cf. A008509.
Intersection of A000217 and A002113.

Programs

  • Mathematica
    palQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn]]; Select[ Accumulate[ Range[200000]],palQ]  (* Harvey P. Dale, Mar 23 2011 *)
    Select[Accumulate[Range[0,170000]],PalindromeQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 15 2019 *)
  • PARI
    list(lim)=my(v=List(),d); for(n=0,(sqrt(8*lim+1)-1)/2, d=digits(n*(n+1)/2); if(d==Vecrev(d), listput(v,n*(n+1)/2))); Vec(v) \\ Charles R Greathouse IV, Jun 23 2017
    
  • Python
    A003098_list = [m for m in (n*(n+1)//2 for n in range(10**5)) if str(m) == str(m)[::-1]] # Chai Wah Wu, Sep 03 2021
Previous Showing 41-50 of 829 results. Next