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

A033865 Start with n; if palindrome, stop; otherwise add to itself with digits reversed; a(n) gives palindrome at which it stops, or -1 if no palindrome is ever reached.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 33, 44, 55, 66, 77, 88, 99, 121, 22, 33, 22, 55, 66, 77, 88, 99, 121, 121, 33, 44, 55, 33, 77, 88, 99, 121, 121, 363, 44, 55, 66, 77, 44, 99, 121, 121, 363, 484, 55, 66, 77, 88, 99, 55, 121, 363, 484, 1111, 66, 77, 88, 99, 121, 121, 66, 484, 1111, 4884, 77, 88, 99, 121, 121, 363, 484, 77, 4884, 44044, 88
Offset: 0

Views

Author

Keywords

Comments

It is believed that a(196) = -1.

Examples

			19 -> 19 + 91 = 110 -> 110 + 011 = 121, so a(19) = 121.
		

References

  • M. Donner, I Love Me, Vol. I: S. Wordrow's palindromic encyclopedia (Algonquin Books, 1996) p. 268

Crossrefs

Cf. A061563, A016016, A023109, A006960, A023108, A002113, A033665 (number of steps).

Programs

  • ARIBAS
    var st: stack; end; for k := 0 to 60 do n := k; while n <> int_reverse(n) do n := n + int_reverse(n); end; stack_push(st,n); end; stack2array(st);
    
  • Mathematica
    Table[NestWhile[# + FromDigits[Reverse[IntegerDigits[#]]] &, n, IntegerDigits[#] != Reverse[IntegerDigits[#]] &], {n, 0, 90}] (* Harvey P. Dale, Dec 18 2011 *)
  • PARI
    a(n)=my(k); while((k=fromdigits(Vecrev(digits(n)))) != n, n += k); n \\ infinite loop if a(n) = -1; Charles R Greathouse IV, Dec 13 2015

Extensions

More terms from Jenise Smalley (neicey01(AT)hotmail.com), Oct 18 2001

A016016 Number of iterations of Reverse and Add which lead to a palindrome, or -1 if no palindrome is ever reached.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A first 'Reverse and Add' operation is always made, even if the starting value n is already a palindrome, in contrast to the variant A033665.
It is conjectured that a(196) = -1, see A023108.
Because A061563 has offset 0 one should add a(0) = 1 here. - Wolfdieter Lang, Jan 12 2018
Record indices and values beyond a(1) = 1 and a(5) = 2 are given in A065198 and A065199: These refer to the variant A033665 (main entry with more up-to-date references), as can be seen from A065199(1..3) = (0, 1, 2) for A065198(1..3) = (0, 10, 19). But all larger records correspond to a non-palindromic index n, in which case a(n) = A033665(n). - M. F. Hasler, Feb 16 2020

Examples

			6 -> 6 + 6 = 12 -> 12 + 21 = 33 is palindromic, took 2 steps so a(6)=2.
n = 89 needs 24 steps to end up with the palindrome 8813200023188. See A240510. - _Wolfdieter Lang_, Jan 12 2018
		

Crossrefs

Programs

  • Mathematica
    tol = 1000; r[n_] := FromDigits[Reverse[IntegerDigits[n]]]; palQ[n_] := n == r[n]; ar[n_] := n + r[n]; Table[k = 0; If[palQ[n], n = ar[n]; k = 1]; While[! palQ[n] && k < tol, n = ar[n]; k++]; If[k == tol, k = -1]; k, {n, 98}] (* Jayanta Basu, Jul 11 2013 *)
    With[{nn = 10^3}, Array[-1 + Length@ NestWhileList[# + IntegerReverse@ # &, #, ! PalindromeQ@ # &, {2, 1}, 10^3] /. k_ /; k == nn -> -1 &, 200, 0]] (* Michael De Vlieger, Jan 11 2018 *)
  • PARI
    a(n) = my(x=n, i=0); while(1, x=x+eval(concat(Vecrev(Str(x)))); i++; if(x==eval(concat(Vecrev(Str(x)))), return(i))) \\ Felix Fröhlich, Jan 12 2018
    
  • PARI
    A016016(n, LIM=exponent(n+1)*5)={-!for(i=0, LIM, my(r=A004086(n)); n==r&&i&&return(i); n+=r)} \\ with {A004086(n)=fromdigits(Vecrev(digits(n)))}. The second optional arg is a search limit, with default value chosen according to known records A065199 and indices A065198. - M. F. Hasler, Feb 16 2020

A088753 Numbers k such that the Reverse and Add! trajectory of k (presumably) does not reach a palindrome (with the exception of k itself) and does not join the trajectory of any term m < k.

Original entry on oeis.org

196, 879, 1997, 7059, 9999, 10553, 10563, 10577, 10583, 10585, 10638, 10663, 10668, 10697, 10715, 10728, 10735, 10746, 10748, 10783, 10785, 10787, 10788, 10877, 10883, 10963, 10965, 10969, 10977, 10983, 10985, 12797, 12898, 13097, 13197, 13694, 14096, 14698, 15297, 15597, 18598, 18798
Offset: 1

Views

Author

Klaus Brockhaus, Nov 04 2003

Keywords

Comments

Although the starting number k is regarded as part of the trajectory, it is allowed to be palindromic. Hence palindromes are not excluded from the sequence. A063048 is obtained if palindromes are excluded. The smallest term in A088753 but not in A063048 is 9999, the smallest term in A063048 but not in A088753 is 19098.
W. VanLandingham and others have computed nearly 10^7 terms (all terms < 10^14), cf. W. VanLandingham, 196 and Other Lychrel Numbers.
From M. F. Hasler, Apr 13 2019: (Start)
Lychrel numbers listed here are also called "seeds", in contrast to Kin numbers A023108 which include all terms in the orbits of the former.
It is not easy to determine whether the orbit of a given term will never merge into the orbit of an earlier term. It seems that the property of "disjoint orbit" is as conjectural as the property of not reaching a palindrome. One could specify a "search limit" in order to get a well-defined sequence. The given list of terms has been checked and extended by considering the orbits up to members of size <= 10^199 at least. Given that the number increases by a factor 10 roughly every 2.416 iterations, this corresponds to about 500 iterations. (End)

Examples

			From _M. F. Hasler_, Apr 13 2019: (Start)
All numbers < 196 quickly reach a palindrome under iterations of the reverse-and-add function A056964, cf. A033665.
a(1) = 196 is the smallest integer which appears to never reach a palindrome (checked up to 10^9 iterations!).
Next, A056964(196) = 196 + 691 = 887 is in the orbit of 196 and will therefore never reach a palindrome if 196 does not. However, we do not list this term in this sequence because it is in the orbit of the smaller term 196.
Similarly, 295 + 592 = 887 = A056964(196). Therefore, 295 will also never reach a palindrome if 196 (and therefore 887) doesn't. But again we will not list this number, because its orbit merges into that of the smaller term 196.
The next number which appears to be a Lychrel and has an orbit (conjectured to be) disjoint with that of 196 is 897 = a(2). (End)
		

Crossrefs

Cf. A063048 (variant excluding palindromes), A023108 (Kin numbers), A056964 (reverse-and-add), A006960 (orbit of 196), A033665 (steps to reach a palindrome), A061563 (terminating palindrome of n's orbit), A002113 (palindromes).

Programs

  • Mathematica
    limit = 10^3; (* Assumes that there is no palindrome if none is found before "limit" iterations *)
    utraj = {};
    Select[Range[0,
      20000], (np = # + IntegerReverse[#];
       x = NestWhileList[ # + IntegerReverse[#] &, np, ! PalindromeQ[#] &, 1, limit];
       If[Length[x] >= limit  && Intersection[x, utraj] == {},
        utraj = Union[utraj, x, {np}]; True,
    utraj = Union[utraj, x, {np}]]) &] (* Robert Price, Oct 16 2019 *)
  • PARI
    A088753_upto(LIM=2e4,M=1e199)={my(U=[],a=List());for(n=1,LIM, my(t=n); while( tA002113(t=A056964(t)) && next(2)); setsearch(U,t) && next; U=setunion(U,[t]); print1(n","); listput(a,n)); Set(a)} \\ M. F. Hasler, Apr 13 2019

Extensions

Edited by M. F. Hasler, Apr 13 2019

A345113 a(n) is the palindrome reached after A345112(n) steps under repeated applications of the map x -> A345111(x), starting with n, or 0 if no palindrome is ever reached.

Original entry on oeis.org

2, 4, 6, 8, 11, 33, 55, 77, 99, 11, 22, 33, 44, 55, 66, 77, 88, 99, 323, 22, 33, 44, 55, 66, 77, 88, 99, 323, 121, 33, 44, 55, 66, 77, 88, 99, 323, 121, 683737386, 44, 55, 66, 77, 88, 99, 323, 121, 683737386
Offset: 1

Views

Author

Felix Fröhlich, Jun 09 2021

Keywords

Comments

First differs from A061563 at n = 19.

Examples

			For n = 19: 19 + 91 = 110, 110 + 101 = 211, 211 + 112 = 323 and 323 is a palindrome, so a(19) = 323.
		

Crossrefs

Programs

  • PARI
    eva(n) = subst(Pol(n), x, 10)
    rot(vec) = if(#vec < 2, return(vec)); my(s=concat(Str(2), ".."), v=[]); s=concat(s, Str(#vec)); v=vecextract(vec, s); v=concat(v, vec[1]); v
    a(n) = my(x=n); while(1, x=x+eva(rot(digits(x))); if(digits(x)==Vecrev(digits(x)), return(x)))
    
  • Python
    def pal(s): return s == s[::-1]
    def rotl(s): return s[1:] + s[0]
    def A345111(n): return n + int(rotl(str(n)))
    def a(n):
        i, iter, seen = 0, n, set()
        while not (iter > n and pal(str(iter))) and iter not in seen:
            seen.add(iter)
            i, iter = i+1, A345111(iter)
        return iter if iter > n and pal(str(iter)) else 0
    print([a(n) for n in range(1, 49)]) # Michael S. Branicky, Jun 09 2021

A062129 In base 2: start with n; add to itself with digits reversed; if palindrome, stop; otherwise repeat; a(n) gives palindrome at which it stops, or -1 if no palindrome is ever reached.

Original entry on oeis.org

0, 11, 11, 1001, 101, 1111, 1001, 10101, 1001, 11011, 1111, 11011, 1111, 11011, 10101, 101101, 10001, 110011, 11011, 1100011, 1100011, 111111, -1, 111111, 11011, 1100011, -1, 11111111, -1, 111111, 101101, 1011101, 100001, 1100011, 110011, -1, 101101, -1, 111111, 1100011, 101101, -1, 111111
Offset: 0

Views

Author

Klaus Brockhaus, Jun 06 2001

Keywords

Comments

The analog of A061563 in base 2. Differs from A062128 only for those n, which are palindromes in base 2.

Examples

			23: 10111 -> 10111 + 11101 = 110100 -> 110100 + 1011 = 111111, so a(23) = 111111.
		

Crossrefs

Programs

  • ARIBAS
    stop := 500; for k := 0 to 60 do c := 0; m := k; test := true; while test and c < stop do inc(c); m := m + bit_reverse(m); test := m <> bit_reverse(m); end; if c < stop then bit_write(m); else write(-1); end; write(" "); end;

A062131 A062129 written in base 10.

Original entry on oeis.org

0, 3, 3, 9, 5, 15, 9, 21, 9, 27, 15, 27, 15, 27, 21, 45, 17, 51, 27, 99, 99, 63, -1, 63, 27, 99, -1, 255, -1, 63, 45, 93, 33, 99, 51, -1, 45, -1, 63, 99, 45, -1, 63, 99, 99, -1, -1, -1, 51, -1, 255, 153, 63, 99, 255, 153, 63, 99, 255, 153, -1, -1, 93, 189, 65, 195, 99, -1, 85, 255, 119, 387, 255, 219, 13299, -1, 387, -1, -1, 219
Offset: 0

Views

Author

Klaus Brockhaus, Jun 06 2001

Keywords

Comments

Differs from A062130 only for those n, which are palindromes in base 2.

Examples

			23 -> 23 + 29 = 52 -> 52 + 11 = 63, so a(23) = 63.
		

Crossrefs

Programs

  • ARIBAS
    stop := 500; for k := 0 to 80 do c := 0; m := k; test := true; while test and c < stop do inc(c); m := m + bit_reverse(m); test := m <> bit_reverse(m); end; if c < stop then write(m); else write(-1); end; write(" "); end;

A253241 The "Reverse and Add!" problem in base 12: sequence lists the final palindrome number for n, or -1 if no palindrome is ever reached. (Written in base 10.)

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 13, 39, 65, 91, 117, 143, 13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 169, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 169, 169, 39, 52, 65, 78, 91, 104, 117, 130, 143, 169, 169, 507, 52, 65, 78, 91, 104, 117, 130, 143, 169, 169, 507, 676, 65, 78, 91, 104, 117
Offset: 0

Views

Author

Eric Chen, Apr 07 2015

Keywords

Comments

Is a(n) = -1 possible? All numbers below 100 (decimal 144) reach a palindrome.
a(237) is conjectured to be -1.
A060382 lists the smallest possible Lychrel number in base n.

Examples

			a(29) = 91 since (in duodecimal) 25 (decimal 29) + 52 = 77 (decimal 91) and 77 is a palindrome.
a(69) = 507 since (in duodecimal) 59 (decimal 69) + 95 = 132, 132 + 231 = 363 (decimal 507) and 363 is a palindrome.
a(105) = 1885 since (in duodecimal) 89 (decimal 105) + 98 = 165, 165 + 561 = 706, 706 + 607 = 1111 (decimal 1885) and 1111 is a palindrome.
		

Crossrefs

Programs

  • Mathematica
    tol = 1728; r[n_] := FromDigits[Reverse[IntegerDigits[n, 12]], 12]; palQ[n_] := n == r[n]; ar[n_] := n + r[n]; Table[k = 0; If[palQ[n], n = ar[n]; k = 1]; While[! palQ[n] && k < tol, n = ar[n]; k++]; If[k == tol, n = -1]; n, {n, 0, 144}]

A260726 a(n) = smallest palindrome k > n such that k/n is a square; a(n) = 0 if no solution exists.

Original entry on oeis.org

4, 8, 363, 484, 5445, 46464, 252, 2138312, 12321, 0, 44, 23232, 31213, 686, 53187678135, 44944, 272, 24642, 171, 0, 525, 88, 575, 46464, 5221225, 62426, 36963, 252, 464, 0, 1783799973871, 291080192, 2112, 4114, 53235, 69696, 333, 20102, 93639, 0, 656, 858858
Offset: 1

Views

Author

Pieter Post, Jul 30 2015

Keywords

Comments

If n is a multiple of 10 then a(n) = 0, since no palindrome ends in 0.
Up to 200 only 3 terms are currently unknown, a(125) > 5.2*10^28, a(177) > 3.5*10^27 and a(185) > 4.5*10^27. See Links for a table of known values. - Giovanni Resta, Aug 05 2015
If a(125) > 0, then the first 3 digits of a(125) are 521 and the last 3 digits of a(125) are 125. Proof: Let m^2 = a(125)/125. Then m is odd as otherwise 125*m^2 is a multiple of 10 which is not a palindrome. Since m is odd, m^2 == 1 mod 8 and thus 125*m^2 == 125 mod 1000. - Chai Wah Wu, Mar 31 2016

Examples

			a(3) = 363, because 363/3 = 11^2. 363 * 3 = 1089, which is also a square.
a(15) = 53187678135, because 53187678135/15 = 59547^2 and 53187678135 * 15 = 893205^2.
		

Crossrefs

Programs

  • Maple
    ispali:= proc(n) local L; L:= convert(n,base,10); ListTools:-Reverse(L)=L end proc:
    f:= proc(n) local m;
       if n mod 10 = 0 then return 0 fi;
       for m from 2 to 10^6 do if ispali(m^2*n) then return m^2*n fi od:
       -1  # signals time-out
    end proc:
    seq(f(n), n=1..50); # Robert Israel, Aug 21 2015
  • Mathematica
    palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; a[n_] := If[ Mod[n, 10] == 0, 0, Block[{q = 2}, While[! palQ[q^2 * n], q++]; q^2 * n]]; Array[a, 42] (* Giovanni Resta, Aug 18 2015 *)
  • Python
    def a(n):
        if n % 10 == 0: return 0
        for c in range(2, 10**8):
            k = str(n * c**2)
            if k == k[::-1]:
                return int(k)
        return -1
    print(*[a(n) for n in range(1, 43)], sep=', ')
    # Corrected by David Radcliffe, May 10 2025

Extensions

Missing a(13) from Giovanni Resta, Aug 05 2015
Showing 1-8 of 8 results.