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

A225367 Number of palindromes of length n in base 3 (A118594).

Original entry on oeis.org

3, 2, 6, 6, 18, 18, 54, 54, 162, 162, 486, 486, 1458, 1458, 4374, 4374, 13122, 13122, 39366, 39366, 118098, 118098, 354294, 354294, 1062882, 1062882, 3188646, 3188646, 9565938, 9565938, 28697814, 28697814, 86093442, 86093442, 258280326, 258280326, 774840978
Offset: 1

Views

Author

M. F. Hasler, May 05 2013

Keywords

Comments

Also: The number of n-digit terms in A006072. See there for further comments.
A palindrome of length L=2k-1 or of length L=2k is determined by the first k digits, which then determine the last k digits by symmetry. Since the first digit cannot be 0 (unless L=1), there are 2*3^(k-1) possibilities for L>1.
Except for the initial term, this is identical to A117855, which counts only nonzero palindromes.

Examples

			The a(1)=3 palindromes of length 1 are: 0, 1 and 2.
The a(2)=2 palindromes of length 2 are: 11 and 22.
		

Crossrefs

Cf. A050683 and A070252 for base 10 analogs.

Programs

  • Magma
    [n eq 1 select 3 else 2*3^Floor((n-1)/2): n in [1..40]]; // Bruno Berselli, May 06 2013
    
  • Magma
    I:=[3,2,6]; [n le 3 select I[n] else 3*Self(n-2): n in [1..40]]; // Vincenzo Librandi, May 31 2017
    
  • Mathematica
    Join[{3}, LinearRecurrence[{0, 3}, {2, 6}, 40]] (* Vincenzo Librandi, May 31 2017 *)
  • PARI
    A225367(n)=2*3^((n-1)\2)+!n
    
  • Python
    def A225367(n): return 3 if n==1 else 3**(n-1>>1)<<1 # Chai Wah Wu, Jul 30 2025

Formula

a(n) = 2*3^floor((n-1)/2) + [n=1].
a(n) = 3*a(n-2) for n>3.
G.f.: x*(3*x^2-2*x-3)/(3*x^2-1).
a(n) = (6-(1+(-1)^n)*(3-sqrt(3)))*sqrt(3)^(n-3) for n>1, a(1)=3. [Bruno Berselli, May 06 2013]

A002113 Palindromes in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515
Offset: 1

Views

Author

Keywords

Comments

n is a palindrome (i.e., a(k) = n for some k) if and only if n = A004086(n). - Reinhard Zumkeller, Mar 10 2002
It seems that if n*reversal(n) is in the sequence then n = 3 or all digits of n are less than 3. - Farideh Firoozbakht, Nov 02 2014
The position of a palindrome within the sequence can be determined almost without calculation: If the palindrome has an even number of digits, prepend a 1 to the front half of the palindrome's digits. If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit. Examples: 98766789 = a(19876), 515 = a(61), 8206028 = a(9206), 9230329 = a(10230). - Hugo Pfoertner, Aug 14 2015
This sequence is an additive basis of order at most 49, see Banks link. - Charles R Greathouse IV, Aug 23 2015
The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - Jonathan Sondow, Nov 27 2017
See A262038 for the "next palindrome" and A261423 for the "preceding palindrome" functions. - M. F. Hasler, Sep 09 2015
The number of palindromes with d digits is 10 if d = 1, and otherwise it is 9 * 10^(floor((d - 1)/2)). - N. J. A. Sloane, Dec 06 2015
Sequence A033665 tells how many iterations of the Reverse-then-add function A056964 are needed to reach a palindrome; numbers for which this will never happen are Lychrel numbers (A088753) or rather Kin numbers (A023108). - M. F. Hasler, Apr 13 2019
This sequence is an additive basis of order 3, see Cilleruelo, Luca, & Baxter and Sigg. - Charles R Greathouse IV, Apr 08 2025

References

  • Karl G. Kröber, "Palindrome, Perioden und Chaoten: 66 Streifzüge durch die palindromischen Gefilde" (1997, Deutsch-Taschenbücher; Bd. 99) ISBN 3-8171-1522-9.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 50-52.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 120.
  • 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

Subsequence of A061917 and A221221.
A110745 is a subsequence.
Union of A056524 and A056525.
Palindromes in bases 2 through 11: A006995 and A057148, A014190 and A118594, A014192 and A118595, A029952 and A118596, A029953 and A118597, A029954 and A118598, A029803 and A118599, A029955 and A118600, this sequence, A029956. Also A262065 (base 60), A262069 (subsequence).
Palindromic primes: A002385. Palindromic nonprimes: A032350.
Palindromic-pi: A136687.
Cf. A029742 (complement), A086862 (first differences).
Palindromic floor function: A261423, also A261424. Palindromic ceiling: A262038.
Cf. A004086 (read n backwards), A064834, A118031, A136522 (characteristic function), A178788.
Ways to write n as a sum of three palindromes: A261132, A261422.
Minimal number of palindromes that add to n using greedy algorithm: A088601.
Minimal number of palindromes that add to n: A261675.

Programs

  • GAP
    Filtered([0..550],n->ListOfDigits(n)=Reversed(ListOfDigits(n))); # Muniru A Asiru, Mar 08 2019
    
  • Haskell
    a002113 n = a002113_list !! (n-1)
      a002113_list = filter ((== 1) . a136522) [1..] -- Reinhard Zumkeller, Oct 09 2011
    
  • Haskell
    import Data.List.Ordered (union)
      a002113_list = union a056524_list a056525_list -- Reinhard Zumkeller, Jul 29 2015, Dec 28 2011
    
  • Magma
    [n: n in [0..600] | Intseq(n, 10) eq Reverse(Intseq(n, 10))]; // Vincenzo Librandi, Nov 03 2014
    
  • Maple
    read transforms; t0:=[]; for n from 0 to 2000 do if digrev(n) = n then t0:=[op(t0),n]; fi; od: t0;
    # Alternatively, to get all palindromes with <= N digits in the list "Res":
    N:=5;
    Res:= $0..9:
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, seq(n*10^m + digrev(n),n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Res:= Res, seq(seq(n*10^(m+1)+y*10^m+digrev(n),y=0..9),n=10^(m-1)..10^m-1);
      fi
    od: Res:=[Res]: # Robert Israel, Aug 10 2014
    # A variant: Gets all base-10 palindromes with exactly d digits, in the list "Res"
    d:=4:
    if d=1 then Res:= [$0..9]:
    elif d::even then
        m:= d/2:
        Res:= [seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1)]:
    else
        m:= (d-1)/2:
        Res:= [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:
    fi:
    Res; # N. J. A. Sloane, Oct 18 2015
    isA002113 := proc(n)
        simplify(digrev(n) = n) ;
    end proc: # R. J. Mathar, Sep 09 2015
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; (* then to generate any base-b sequence for 1 < b < 37, replace the 10 in the following instruction with b: *) Select[Range[0, 1000], palQ[#, 10] &]
    base10Pals = {0}; r = 2; Do[Do[AppendTo[base10Pals, n * 10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}]; Do[AppendTo[base10Pals, n * 10^IntegerLength[n] + FromDigits@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}], {e, r}]; base10Pals (* Arkadiusz Wesolowski, May 04 2012 *)
    nthPalindromeBase[n_, b_] := Block[{q = n + 1 - b^Floor[Log[b, n + 1 - b^Floor[Log[b, n/b]]]], c = Sum[Floor[Floor[n/((b + 1) b^(k - 1) - 1)]/(Floor[n/((b + 1) b^(k - 1) - 1)] - 1/b)] - Floor[Floor[n/(2 b^k - 1)]/(Floor[n/(2 b^k - 1)] - 1/ b)], {k, Floor[Log[b, n]]}]}, Mod[q, b] (b + 1)^c * b^Floor[Log[b, q]] + Sum[Floor[Mod[q, b^(k + 1)]/b^k] b^(Floor[Log[b, q]] - k) (b^(2 k + c) + 1), {k, Floor[Log[b, q]]}]] (* after the work of Eric A. Schmidt, works for all integer bases b > 2 *)
    Array[nthPalindromeBase[#, 10] &, 61, 0] (* please note that Schmidt uses a different, a more natural and intuitive offset, that of a(1) = 1. - Robert G. Wilson v, Sep 22 2014 and modified Nov 28 2014 *)
    Select[Range[10^3], PalindromeQ] (* Michael De Vlieger, Nov 27 2017 *)
    nLP[cn_Integer]:=Module[{s,len,half,left,pal,fdpal},s=IntegerDigits[cn]; len=Length[s]; half=Ceiling[len/2]; left=Take[s,half]; pal=Join[left,Reverse[ Take[left,Floor[len/2]]]]; fdpal=FromDigits[pal]; Which[cn==9,11,fdpal>cn,fdpal,True,left=IntegerDigits[ FromDigits[left]+1]; pal=Join[left,Reverse[Take[left,Floor[len/2]]]]; FromDigits[pal]]]; NestList[nLP,0,100] (* Harvey P. Dale, Dec 10 2024 *)
  • PARI
    is_A002113(n)=Vecrev(n=digits(n))==n \\ M. F. Hasler, Nov 17 2008, updated Apr 26 2014, Jun 19 2018
    
  • PARI
    is(n)=n=digits(n);for(i=1,#n\2,if(n[i]!=n[#n+1-i],return(0))); 1 \\ Charles R Greathouse IV, Jan 04 2013
    
  • PARI
    a(n)={my(d,i,r);r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11));n=n-10^(#digits(n\11));d=digits(n);for(i=1,#d,r[i]=d[i];r[#r+1-i]=d[i]);sum(i=1,#r,10^(#r-i)*r[i])} \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ recursive--feed an element a(n) and it gives a(n+1)
    nxt(n)=my(d=digits(n));i=(#d+1)\2;while(i&&d[i]==9,d[i]=0;d[#d+1-i]=0;i--);if(i,d[i]++;d[#d+1-i]=d[i],d=vector(#d+1);d[1]=d[#d]=1);sum(i=1,#d,10^(#d-i)*d[i]) \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ feed a(n), returns n.
    inv(n)={my(d=digits(n));q=ceil(#d/2);sum(i=1,q,10^(q-i)*d[i])+10^floor(#d/2)} \\ David A. Corneth, Jun 18 2014
    
  • PARI
    inv_A002113(P)={P\(P=10^(logint(P+!P,10)\/2))+P} \\ index n of palindrome P = a(n), much faster than above: no sum is needed. - M. F. Hasler, Sep 09 2018
    
  • PARI
    A002113(n,L=logint(n,10))=(n-=L=10^max(L-(n<11*10^(L-1)),0))*L+fromdigits(Vecrev(digits(if(nM. F. Hasler, Sep 11 2018
    
  • Python
    # edited by M. F. Hasler, Jun 19 2018
    def A002113_list(nMax):
      mlist=[]
      for n in range(nMax+1):
         mstr=str(n)
         if mstr==mstr[::-1]:
            mlist.append(n)
      return mlist # Bill McEachen, Dec 17 2010
    
  • Python
    from itertools import chain
    A002113 = sorted(chain(map(lambda x:int(str(x)+str(x)[::-1]),range(1,10**3)),map(lambda x:int(str(x)+str(x)[-2::-1]), range(10**3)))) # Chai Wah Wu, Aug 09 2014
    
  • Python
    from itertools import chain, count
    A002113 = chain(k for k in count(0) if str(k) == str(k)[::-1])
    print([next(A002113) for k in range(60)]) # Jan P. Hartkopf, Apr 10 2021
    
  • Python
    is_A002113 = lambda n: (s:=str(n))[::-1]==s # M. F. Hasler, May 23 2024
    
  • Python
    from math import log10, floor
    def A002113(n):
      if n < 2: return 0
      P = 10**floor(log10(n//2)); M = 11*P
      s = str(n - (P if n < M else M-P))
      return int(s + s[-2 if n < M else -1::-1]) # M. F. Hasler, Jun 06 2024
    
  • SageMath
    [n for n in (0..515) if Word(n.digits()).is_palindrome()] # Peter Luschny, Sep 13 2018
    
  • Scala
    def palQ(n: Int, b: Int = 10): Boolean = n - Integer.parseInt(n.toString.reverse) == 0
    (0 to 999).filter(palQ()) // _Alonso del Arte, Nov 10 2019

Formula

A136522(a(n)) = 1.
A178788(a(n)) = 0 for n > 9. - Reinhard Zumkeller, Jun 30 2010
A064834(a(n)) = 0. - Reinhard Zumkeller, Sep 18 2013
a(n+1) = A262038(a(n)+1). - M. F. Hasler, Sep 09 2015
Sum_{n>=2} 1/a(n) = A118031. - Amiram Eldar, Oct 17 2020
a(n) = (floor(d(n)/(c(n)*9 + 1)))*10^A055642(d(n)) + A004086(d(n)) where b(n, k) = ceiling(log((n + 1)/k)/log(10)), c(n) = b(n, 2) - b(n, 11) and d(n) = (n - A086573(b(n*(2 - c(n)), 2) - 1)/2 - 1). - Alan Michael Gómez Calderón, Mar 11 2025

A014190 Palindromes in base 3 (written in base 10).

Original entry on oeis.org

0, 1, 2, 4, 8, 10, 13, 16, 20, 23, 26, 28, 40, 52, 56, 68, 80, 82, 91, 100, 112, 121, 130, 142, 151, 160, 164, 173, 182, 194, 203, 212, 224, 233, 242, 244, 280, 316, 328, 364, 400, 412, 448, 484, 488, 524, 560, 572, 608, 644, 656, 692, 728, 730, 757
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

Cf. A007089, A118594, A134027, A330312 (first differences).
Palindromes in bases 2 through 10: A006995, A014190, A014192, A029952, A029953, A029954, A029803, A029955, A002113.

Programs

  • Magma
    [n: n in [0..800] | Intseq(n, 3) eq Reverse(Intseq(n, 3))]; // Vincenzo Librandi, Sep 09 2015
    
  • Maple
    isA014190 := proc(n)
        local L;
        L := convert(n,base,3) ;
        ListTools[Reverse](L) = L ;
    end proc:
    for n from 0 to 500 do
        if isA014190(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Jul 07 2015
  • Mathematica
    f[n_,b_] := Module[{i=IntegerDigits[n,b]}, i==Reverse[i]]; lst={}; Do[If[f[n,3], AppendTo[lst,n]], {n,1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
  • PARI
    ispal(n,b=3)=my(d=digits(n,b)); d==Vecrev(d) \\ Charles R Greathouse IV, May 03 2020
    
  • Python
    from gmpy2 import digits
    def A014190(n):
        if n == 1: return 0
        y = 3*(x:=3**(len(digits(n>>1,3))-1))
        return int((c:=n-x)*x+int(digits(c,3)[-2::-1]or'0',3) if nChai Wah Wu, Jun 13 2024
  • Sage
    [n for n in (0..757) if Word(n.digits(3)).is_palindrome()] # Peter Luschny, Sep 13 2018
    

Formula

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

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
    

A006072 Numbers with mirror symmetry about middle.

Original entry on oeis.org

0, 1, 8, 11, 88, 101, 111, 181, 808, 818, 888, 1001, 1111, 1881, 8008, 8118, 8888, 10001, 10101, 10801, 11011, 11111, 11811, 18081, 18181, 18881, 80008, 80108, 80808, 81018, 81118, 81818, 88088, 88188, 88888, 100001, 101101, 108801, 110011, 111111, 118811, 180081
Offset: 1

Views

Author

Keywords

Comments

Apparently this sequence and A111065 have the same parity. - Jeremy Gardiner, Oct 15 2005
Obviously, terms of this sequence also have the same parity (and also the same digital sum mod 6) as those of A118594, see below. - M. F. Hasler, May 08 2013
The number of n-digit terms is given by A225367 -- which counts palindromes in base 3, A118594. The terms here are the base 3 palindromes considered there, with 2 replaced by 8 (which means this sequence A006072 arises from A118594 not only by taking the 3rd power of each digit, but also by superposing the number with its horizontal or vertical reflection, somehow remarkably given the symmetry of numbers considered here). - M. F. Hasler, May 05 2013 [Part of the comment moved from A225367 to here on May 08 2013]

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Subsequence of A000787. Cf. A045574.

Programs

  • Mathematica
    NextPalindrome[n_] := Block[{l = Floor[Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[idn, Ceiling[l/2]]]] > FromDigits[ Take[idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[idn, Ceiling[l/2]], Reverse[ Take[idn, Floor[l/2]]]]], idfhn = FromDigits[ Take[idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[ idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]]]]]]; np = 0; t = {0}; Do[np = NextPalindrome[np]; If[Union[Join[{0, 1, 8}, IntegerDigits[np]]] == {0, 1, 8}, AppendTo[t, np]], {n, 1150}]; t (* Robert G. Wilson v *)
    TetrNumsUpTo10powerK[k_]:= Select[FromDigits/@ Tuples[{0, 1, 8}, k],IntegerDigits[#] == Reverse[IntegerDigits[#]] &]; TetrNumsUpTo10powerK[7] (* Mikk Heidemaa, May 21 2017 *)
  • PARI
    {for(l=1,5,u=vector((l+1)\2,i,10^(i-1)+(2*i-11&&i==1,2]), print1((v+v\2*6)*u", ")))} \\ The n-th term could be produced by using (partial sums of) A225367 to skip all shorter terms, and then skipping the adequate number of vectors v until n is reached. - M. F. Hasler, May 05 2013
    
  • Python
    from itertools import count, islice, product
    def agen():
        yield from [0, 1, 8]
        for d in count(2):
            for start in "18":
                for rest in product("018", repeat=d//2-1):
                    left = start + "".join(rest)
                    for mid in [[""], ["0", "1", "8"]][d%2]:
                        yield int(left + mid + left[::-1])
    print(list(islice(agen(), 42))) # Michael S. Branicky, Mar 29 2022

Formula

a(n) = digit-wise application of A000578 to A118594(n). - M. F. Hasler, May 08 2013

Extensions

More terms from Robert G. Wilson v, Nov 16 2005

A118595 Palindromes in base 4 (written in base 4).

Original entry on oeis.org

0, 1, 2, 3, 11, 22, 33, 101, 111, 121, 131, 202, 212, 222, 232, 303, 313, 323, 333, 1001, 1111, 1221, 1331, 2002, 2112, 2222, 2332, 3003, 3113, 3223, 3333, 10001, 10101, 10201, 10301, 11011, 11111, 11211, 11311, 12021, 12121, 12221, 12321, 13031
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Comments

2*a(n) and 3*a(n) give palindromes in base 10 for any n. - Arkadiusz Wesolowski, Jun 22 2012
Equivalently, palindromes k (written in base 10) such that 3*k is a palindrome. - Bruno Berselli, Sep 12 2018

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 290], Max@IntegerDigits@# < 4 &] (* Robert G. Wilson v, May 09 2006 *)
  • Python
    from gmpy2 import digits
    def A118595(n):
        if n == 1: return 0
        y = (x:=1<<(n.bit_length()-2&-2))<<2
        return int((s:=digits(n-x,4))+s[-2::-1] if nChai Wah Wu, Jun 14 2024

Extensions

More terms from Robert G. Wilson v, May 09 2006

A118597 Palindromes in base 6 (written in base 6).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 11, 22, 33, 44, 55, 101, 111, 121, 131, 141, 151, 202, 212, 222, 232, 242, 252, 303, 313, 323, 333, 343, 353, 404, 414, 424, 434, 444, 454, 505, 515, 525, 535, 545, 555, 1001, 1111, 1221, 1331, 1441, 1551, 2002, 2112, 2222, 2332, 2442, 2552
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Comments

Also palindromes with no digit greater than 5. - Harvey P. Dale, Nov 26 2019

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 125], Max@IntegerDigits@# < 6 &] (* Robert G. Wilson v, May 09 2006 *)
    Select[FromDigits/@Tuples[Range[0,5],4],PalindromeQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 26 2019 *)
  • Python
    from sympy import integer_log
    from gmpy2 import digits
    def A118597(n):
        if n == 1: return 0
        y = 6*(x:=6**integer_log(n>>1,6)[0])
        return int((s:=digits(n-x,6))+s[-2::-1] if nChai Wah Wu, Jun 14 2024

Extensions

Corrected and extended by Robert G. Wilson v, May 09 2006

A118598 Palindromes in base 7 (written in base 7).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 22, 33, 44, 55, 66, 101, 111, 121, 131, 141, 151, 161, 202, 212, 222, 232, 242, 252, 262, 303, 313, 323, 333, 343, 353, 363, 404, 414, 424, 434, 444, 454, 464, 505, 515, 525, 535, 545, 555, 565, 606, 616, 626, 636, 646, 656, 666, 1001
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 109], Max@IntegerDigits@# < 7 &] (* Robert G. Wilson v, May 09 2006 *)
  • Python
    from sympy import integer_log
    from gmpy2 import digits
    def A118598(n):
        if n == 1: return 0
        y = 7*(x:=7**integer_log(n>>1,7)[0])
        return int((s:=digits(n-x,7))+s[-2::-1] if nChai Wah Wu, Jun 14 2024

Extensions

Corrected and extended by Robert G. Wilson v, May 09 2006

A118596 Palindromes in base 5 (written in base 5).

Original entry on oeis.org

0, 1, 2, 3, 4, 11, 22, 33, 44, 101, 111, 121, 131, 141, 202, 212, 222, 232, 242, 303, 313, 323, 333, 343, 404, 414, 424, 434, 444, 1001, 1111, 1221, 1331, 1441, 2002, 2112, 2222, 2332, 2442, 3003, 3113, 3223, 3333, 3443, 4004, 4114, 4224, 4334, 4444, 10001
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Comments

Equivalently, palindromes k (written in base 10) such that 2*k is a palindrome. - Bruno Berselli, Sep 12 2018

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 198], Max@IntegerDigits@# < 5 &] (* Robert G. Wilson v, May 09 2006 *)
    Select[FromDigits/@IntegerDigits[Range[1000],5],PalindromeQ] (* Fred Patrick Doty, Aug 12 2017 *)
  • PARI
    is(n)=if(n<5, return(n>=0)); my(d=digits(n)); vecmax(d)<5 && Vecrev(d)==d \\ Charles R Greathouse IV, Aug 22 2017
    
  • Python
    from sympy import integer_log
    from gmpy2 import digits
    def A118596(n):
        if n == 1: return 0
        y = 5*(x:=5**integer_log(n>>1,5)[0])
        return int((s:=digits(n-x,5))+s[-2::-1] if nChai Wah Wu, Jun 14 2024

Extensions

More terms from Robert G. Wilson v, May 09 2006

A118599 Palindromes in base 8 (written in base 8).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 11, 22, 33, 44, 55, 66, 77, 101, 111, 121, 131, 141, 151, 161, 171, 202, 212, 222, 232, 242, 252, 262, 272, 303, 313, 323, 333, 343, 353, 363, 373, 404, 414, 424, 434, 444, 454, 464, 474, 505, 515, 525, 535, 545, 555, 565, 575, 606, 616
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 70], Max@IntegerDigits@# < 8 &] (* Robert G. Wilson v, May 09 2006 *)
  • Python
    def A118599(n):
        if n == 1: return 0
        y = (x:=1<<(m:=n.bit_length()-2)-m%3)<<3
        return int((s:=oct(n-x)[2:])+s[-2::-1] if nChai Wah Wu, Jun 14 2024

Extensions

More terms from Robert G. Wilson v, May 09 2006
Showing 1-10 of 14 results. Next