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 11-20 of 32 results. Next

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

A033670 Trajectory of 89 under map x->x + (x-with-digits-reversed).

Original entry on oeis.org

89, 187, 968, 1837, 9218, 17347, 91718, 173437, 907808, 1716517, 8872688, 17735476, 85189247, 159487405, 664272356, 1317544822, 3602001953, 7193004016, 13297007933, 47267087164, 93445163438
Offset: 0

Views

Author

Keywords

Comments

The sequence reaches a palindrome at a(24)= 8813200023188 (cf. A033665). - Klaus Brockhaus, Jun 07 2002

Examples

			a(3) = 968 because 187 + 781 = 968
		

References

  • Popular Computing (Calabasas, CA), The 196 Problem, Vol. 3 (No. 30, Sep 1975), page PC30-6. Gives full 25-term trajectory of 89.

Programs

  • Mathematica
    NestList[# + FromDigits[Reverse[IntegerDigits[#]]]&, 89, 40] (* Vincenzo Librandi, May 03 2014 *)

A065207 Numbers which need two 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

19, 28, 37, 39, 46, 48, 49, 57, 58, 64, 67, 73, 75, 76, 82, 84, 85, 91, 93, 94, 109, 119, 129, 139, 149, 150, 152, 153, 154, 159, 160, 162, 163, 169, 170, 172, 173, 179, 189, 208, 218, 219, 228, 229, 238, 239, 248, 250, 251, 253, 258, 259, 260, 261, 268, 269
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 2. - Andrew Howroyd, Dec 06 2024

Crossrefs

Programs

  • ARIBAS
    revadd_steps(2,58); (* For the definition of function revadd_steps see A065206. *)
    
  • Mathematica
    trasQ[n_]:=Length[NestWhileList[IntegerReverse[#]+#&,n,!PalindromeQ[ #]&,1,5]] ==3; Select[Range[300],trasQ] (* Harvey P. Dale, Apr 13 2022 *)
  • PARI
    isok(n,s=2)={for(k=0, s, my(r=fromdigits(Vecrev(digits(n)))); if(r==n, return(k==s)); n += r); 0} \\ Andrew Howroyd, Dec 06 2024
  • Python
    def ra(n): s = str(n); return int(s) + int(s[::-1])
    def ispal(n): s = str(n); return s == s[::-1]
    def aupto(limit):
      alst = []
      for k in range(limit+1):
        if ispal(k): continue
        k2 = ra(k)
        if ispal(k2): continue
        if ispal(ra(k2)): alst.append(k)
      return alst
    print(aupto(269)) # Michael S. Branicky, May 06 2021
    

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009

A193239 Number of "Reverse and Add" steps needed to reach a palindrome using the complex base -1+i, or -1 if a palindrome is never reached.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, -1, 0, 1, 0, 1, 6, 1, 6, 1, 0, 1, 0, 1, 4, -1, 0, -1, -1, 1, 4, -1, 0, -1, -1, 5, 0, 1, 0, 1, 6, 1, -1, 1, -1, 1, -1, 1, -1, -1, 0, 7, -1, 1, 6, 7, 0, 1, -1, 1, 2, 1, -1, 1, 2, 7, -1, -1, 0, 1, 0, 1, -1, 1, -1, 1, -1, 3, 0, -1, -1, 9, 2, 1
Offset: 0

Views

Author

Kerry Mitchell, Jul 19 2011

Keywords

Comments

N is converted to its binary representation before iterating.

Examples

			Decimal 2 is 10 in binary, which is -1+i using complex base -1+i. Reversing 10 gives 01, or 1+0i.  Adding both results in 0+i, or 11 using the complex base, which is a palindrome.  Decimal 2 took 1 step to reach a palindrome, so a(2) = 1.
		

Crossrefs

Cf. A033665 gives the steps to reach a palindrome in base 10.

A065208 Numbers which need three 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

59, 68, 86, 95, 155, 156, 157, 158, 164, 165, 168, 178, 180, 184, 185, 186, 194, 199, 249, 254, 255, 256, 257, 263, 264, 267, 277, 283, 284, 285, 293, 298, 299, 348, 349, 354, 355, 356, 362, 366, 376, 382, 384, 389, 392, 397, 398, 399, 439, 447, 448, 449, 452, 453, 455, 461, 462, 465, 475, 481, 482
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 3. - Andrew Howroyd, Dec 06 2024

Crossrefs

Programs

  • ARIBAS
    revadd_steps(3,54). For the definition of function revadd_steps see A065206.
    
  • Mathematica
    palQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn]]
    tst[n_]:=palQ/@NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&,n,3]=={False,False,False,True}
    Select[Range[750],tst] (* Harvey P. Dale, Nov 26 2010 *)
  • PARI
    isok(n,s=3)={for(k=0, s, my(r=fromdigits(Vecrev(digits(n)))); if(r==n, return(k==s)); n += r); 0} \\ Andrew Howroyd, Dec 06 2024

Extensions

Offset changed from 0 to by Harry J. Smith, Oct 14 2009
More terms from Harvey P. Dale, Nov 26 2010

A065209 Numbers which need four 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

69, 78, 87, 96, 174, 175, 183, 192, 195, 273, 274, 280, 290, 291, 294, 372, 381, 390, 471, 472, 480, 492, 539, 570, 571, 579, 591, 599, 629, 638, 649, 670, 678, 679, 690, 698, 699, 728, 729, 748, 749, 769, 778, 789, 798, 819, 827, 836, 839, 847, 876, 877
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 4. - Andrew Howroyd, Dec 06 2024

Crossrefs

Programs

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009

A065210 Numbers which need five 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

166, 176, 198, 265, 275, 297, 364, 374, 396, 463, 473, 495, 549, 562, 572, 594, 639, 648, 661, 671, 693, 738, 760, 770, 792, 837, 846, 891, 936, 945, 990, 1396, 1486, 1576, 1666, 1697, 1756, 1787, 1791, 1793, 1796, 1846, 1877, 1883, 1886, 1890, 1936
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 5. - Andrew Howroyd, Dec 06 2024

Crossrefs

Programs

  • Mathematica
    palQ[k_]:=IntegerDigits[k]==Reverse[IntegerDigits[k]]; fraQ[n_]:= Module[ {ras=NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&,n,5]},palQ/@ ras=={False,False,False,False,False,True}]; Select[Range[2000],fraQ] (* Harvey P. Dale, Sep 28 2015 *)

Extensions

Offset changed to 1 by Harry J. Smith, Oct 14 2009

A065211 Numbers which need six 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

79, 97, 182, 281, 380, 779, 799, 889, 977, 988, 997, 1069, 1079, 1159, 1169, 1249, 1259, 1339, 1349, 1429, 1439, 1519, 1529, 1609, 1619, 1699, 1709, 1789, 1799, 1879, 1889, 1896, 1969, 1979, 1986, 2059, 2068, 2078, 2089, 2149, 2158, 2168, 2179, 2239
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 6. - Andrew Howroyd, Dec 06 2024

Crossrefs

Programs

  • Mathematica
    palQ[n_] := Module[{idn = IntegerDigits[n]}, idn == Reverse[idn]]; pal6Q[ n_]:= Module[{c=NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&, n,6]}, palQ/@c=={False,False,False,False,False,False,True}]; Select[Range[ 2300],pal6Q] (* Harvey P. Dale, Sep 09 2012 *)

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009

A065212 Numbers which need seven 'Reverse and Add' steps to reach a palindrome.

Original entry on oeis.org

188, 190, 197, 287, 296, 386, 395, 485, 584, 593, 683, 692, 782, 791, 881, 890, 980, 1394, 1484, 1574, 1664, 1754, 1844, 1898, 1934, 1988, 1992, 1994, 1999, 2393, 2483, 2573, 2663, 2753, 2843, 2897, 2933, 2987, 2991, 2993, 2998, 3089, 3179, 3269, 3359
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
Numbers k such that A033665(k) = 7. - Andrew Howroyd, Dec 08 2024

Crossrefs

Programs

  • Mathematica
    lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n,#!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 10]] == 8; Select[Range[500], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009
Previous Showing 11-20 of 32 results. Next