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

A117816 Number of steps until the RADD sequence T(k+1) = n + R(T(k)), T(0) = 1, enters a cycle; -1 if no cycle is ever reached. (R=A004086: reverse digits).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 2, 31, 15, -1, 721, 9, 1, 6, -1, 3, 5, 28, 29, 131, 23, 1, 31, 6, -1, 1, 19, 1, 53, 4, 406, 34, 254, 8, -1, 3, 245, 1, 3, 2, 422, 42, 308, 1, -1, 2, 2, 49, 1, 1371, 13, 1, 1, 2, -1, 78, 65, 1, 809, 1575, 5, 43, 31, 2, -1, 33, 2, 21, 192, 857, 91, 1, 2, 2, -1, 2, 491, 1, 2, 1, 81, 49, 1, 2, -1, 35, 197, 72, 1, 12, 79, 1, 6004, 1, -1, 52, 10264, 9, 28, 2, 2, 1, 427, 1, -1, 1, 1, 49, 167
Offset: 1

Views

Author

N. J. A. Sloane, following discussions with Luc Stevens, May 04 2006

Keywords

Comments

Comments following discussions with David Applegate, May 05 2006: (Start)
Certainly a(10) = -1 and probably a(n) is always -1 if n is a multiple of 10. Furthermore a(15) is almost certainly -1: T_15 has not reached a cycle in 10^7 terms (see A118532).
(End)
If n is a multiple of 10 the operation can never generate a trailing zero and so is reversible. So it loops only if it returns to the start, which is impossible. Hence a(10k) = -1. - Martin Fuller, May 12 2006
I suspect a(115) = 385592406, A117817(115) = 79560. Can someone confirm? - Martin Fuller, May 12 2006
The map f: x -> R(x)+n is injective, f(x)=f(y) <=> R(x)=R(y) <=> x=y, unless x or y only differ in trailing zeros. For n=10k, however, trailing zeros can never occur. (This also implies that the terms are of increasing length.) Thus, for n=10k, no number can occur twice in the orbit of 1 under f, i.e., a(10k)=-1. A sketch of proof for a(15)=-1 is given in A118532. As of today, no other n with a(n)=-1 seems to be known. - M. F. Hasler, May 06 2012

Examples

			T_2 enters a cycle of length 81 after 1 step.
		

Crossrefs

For T_1, T_2, ..., T_16 (omitting T_9, which is uninteresting) see A117230, A117521, A118517, A117828, A117800, A118525, A118526, A118527, A117841, A118528, A118529, A118530, A118531, A118532, A118533.
Cf. A117817.

Programs

  • Mathematica
    ReverseNum[n_] := FromDigits[Reverse[IntegerDigits[n]]]; maxLen=10000; Table[z=1; lst={1}; While[z=ReverseNum[z]+n; !MemberQ[lst,z] && Length[lst]T. D. Noe *)
  • PARI
    A117816(n,L=10^5,S=1)={ for(F=0,1, my(u=Vecsmall(S)); while(L-- & #u<#u=vecsort(concat(u,Vecsmall(S=A004086(S)+n)),,8),); L || F=1; /* 1st run counts until repetition, now subtract cycle length */ F || L=1+#u); L-1}

Extensions

a(21)-a(33) from Luc Stevens, May 08 2006
a(33) onwards from T. D. Noe, May 10 2006
Further terms from Martin Fuller, May 12 2006

A117831 Let S_n be the infinite sequence formed by starting with n and repeatedly reversing the digits and adding 4 to get the next term. Sequence gives number of steps for S_n to reach a cycle, or -1 if no cycle is ever reached.

Original entry on oeis.org

1, 1, 40, 7, 0, 0, 39, 6, 0, 0, 38, 5, 0, 18, 37, 3, 0, 43, 10, 0, 4, 42, 9, 4, 4, 41, 7, 0, 47, 40, 0, 8, 46, 13, 0, 8, 45, 11, 0, 7, 44, 0, 12, 50, 17, 3, 12, 49, 15, 1, 11, 48, 1, 16, 36, 3, 0, 16, 35, 1, 0, 41, 8, 2, 2, 40, 7, 2, 2, 39, 5, 0, 45, 12, 0, 6, 44, 11, 0, 6, 43, 9, 0, 49, 42, 0, 10
Offset: 1

Views

Author

N. J. A. Sloane, following discussions with Luc Stevens, May 03 2006

Keywords

Comments

It is conjectured that S_n always reaches a cycle.
There are 22 different cycles of length 90 with 4-digit components. I guess that at most half of the numbers between 1000 and 10000 lead to the cycle of length 54 shown in A117830. - Klaus Brockhaus, May 05 2006

Crossrefs

S_1 is given in A117828, S_3 in A117829, S_1015 in A117807.
Records are in A118473, A118474.
Full list of sequences on this topic (1): A117230, A117521, A117800, A117816, A117817, A117827, A117828, A117829, A117830, A117831 (this sequence)
Full list of sequences on this topic (2): A117837, A117841, A118473, A118474, A118510, A118511, A118512, A118513, A118514, A118515, A118516
Full list of sequences on this topic (3): A118517-A118533, A118535

Programs

  • Maple
    V:= Vector(10^5,-1):
    f:= proc(n)
      local L, H, S, i, j,found,x,y;
      global V;
      S:= {n}: H:= n; x:= n;
      for i from 1 to 10^5 do
        if V[x] > -1 then
           for j from 1 to i-1 do V[H[j]]:= i-j+V[x] od;
           return V[n];
        fi;
        L:= convert(x,base,10);
        x:= add(L[-j]*10^(j-1),j=1..nops(L)) + 4;
        if member(x, S) then
          found:= false; y:= 0;
          V[x]:= 0;
          for j from i by -1 to 1 do
            if H[j] = x then found:= true
            elif not found then V[H[j]]:= 0
            else y:= y+1; V[H[j]]:= y;
            fi
          od;
          return V[n]
        fi;
        H:= H, x;
        S:= S union {x};
      od;
    end proc:
    map(f, [$1..200]); # Robert Israel, May 07 2020

Extensions

Corrected and extended by Klaus Brockhaus, May 05 2006
Confirmed by N. J. A. Sloane, May 05 2006

A118514 Define sequence S_n by: initial term = n, reverse digits and add 2 to get next term. It is conjectured that S_n always reaches a cycle. Sequence gives number of steps for S_n to reach a cycle.

Original entry on oeis.org

1, 3, 0, 2, 0, 1, 0, 0, 0, 0, 0, 9, 0, 7, 10, 0, 9, 4, 0, 3, 8, 8, 8, 7, 15, 5, 5, 3, 12, 1, 11, 16, 0, 7, 0, 5, 8, 0, 7, 2, 0, 6, 6, 6, 6, 5, 13, 3, 3, 1, 10, 6, 9, 14, 0, 5, 0, 3, 6, 0, 5, 4, 0, 4, 4, 4, 4, 3, 11, 1, 1, 13, 8, 4, 7, 12, 0, 3, 0, 1, 4, 2, 3, 2, 0, 2, 2, 2, 2, 1, 9, 12, 0
Offset: 1

Views

Author

N. J. A. Sloane, May 06 2006

Keywords

Comments

Initial cycles have length 81 or 90.
There is one cycle of length 81 (least component is 3, all components have at most three digits, cf. A117521), 22 cycles of length 90 with 4-digit components (least components are 1013 + 2*k for k = 0, ..., 21, cf. A120214) and one cycle of length 45 with 4-digit components (least component is 1057, cf. A120215). Furthermore there are 22 cycles of length 1890 (least components are 100013 + 2*k for k = 0, ..., 21, cf. A120216), one cycle of length 945 (least component is 100057, cf. A120217) and 225 cycles of length 900 (least components are 100103 + 2*k for k = 0, ..., 224, cf. A120218), all having 6-digit components. It is conjectured that there are also cycles of increasing length with 8-, 10-, 12-, ... digit components. - Klaus Brockhaus, Jun 10 2006
From Michael S. Branicky, May 11 2023: (Start)
There are 22 cycles of length 19890 (least components are 10000013 + 2*k for k = 0, ..., 21), one cycle of length 9945 (least component 10000057), 225 cycles of length 18900 (least components are 10000103 + 2*k for k = 0, ..., 224) and 2250 cycles of length 9000 (least components are 10001003 + 2*k for k = 0, ..., 2249), all having 8-digit components.
These patterns continue. Specifically, there is one cycle of length 10^(n/2) - 55 (least component 10^(n-1) + 57), and there are 22 cycles of length 2*(10^(n/2) - 55) (least components 10^(n-1) + 13 + 2*k for k = 0, ..., 21), each for n = 4, 6, 8, 10, 12, 14, 16. (End)

Crossrefs

For records see A118515, A118516. Cf. A117831. S_1 is A117521.
S_1013 is A120214, S_1057 is A120215, S_100013 is A120216, S_100057 is A120217, S_100103 is A120218.

Programs

  • Python
    # see linked program

A117230 Start with 1 and repeatedly reverse the digits and add 1 to get the next term.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 3, 4, 5, 6, 7, 8, 9, 10
Offset: 1

Views

Author

N. J. A. Sloane, following discussions with Luc Stevens, May 04 2006

Keywords

Crossrefs

Programs

  • Maple
    read transforms; t1:=[1]; for n from 1 to 80 do t1:=[op(t1),1+digrev(t1[n])]; od:
  • Mathematica
    Join[{1},LinearRecurrence[{0,0,0,0,0,0,0,0,1},{2,3,4,5,6,7,8,9,10},99]] (* Ray Chandler, Jul 18 2015 *)
  • PARI
    a(n)=if(n>1,(n-2)%9+2,1) \\ M. F. Hasler, May 22 2014

Formula

Has period 9.
G.f.: -x*(9*x^9 +9*x^8 +8*x^7 +7*x^6 +6*x^5 +5*x^4 +4*x^3 +3*x^2 +2*x +1) / ((x -1)*(x^2 +x +1)*(x^6 +x^3 +1)). - Colin Barker, May 23 2014

Extensions

Correction to the terms of the sequence (inserted missing term) Jeremy Gardiner, Jun 17 2010

A120214 Start with 1013 and repeatedly reverse the digits and add 2 to get the next term.

Original entry on oeis.org

1013, 3103, 3015, 5105, 5017, 7107, 7019, 9109, 9021, 1211, 1123, 3213, 3125, 5215, 5127, 7217, 7129, 9219, 9131, 1321, 1233, 3323, 3235, 5325, 5237, 7327, 7239, 9329, 9241, 1431, 1343, 3433, 3345, 5435, 5347, 7437, 7349, 9439, 9351, 1541, 1453, 3543
Offset: 1

Views

Author

Klaus Brockhaus, Jun 11 2006

Keywords

Comments

Let T(S,Q) be the sequence obtained by starting with S and repeatedly reversing the digits and adding Q to get the next term. This is T(1013,2). 1013 is the first S for which T(S,2) reaches a cycle of length 90. The cycle is simply the first 90 terms, which then repeat. A full period is given in the table.

Crossrefs

Programs

  • Mathematica
    NestList[IntegerReverse[#]+2&,1013,50] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 16 2016 *)

A120216 Start with 100013 and repeatedly reverse the digits and add 2 to get the next term.

Original entry on oeis.org

100013, 310003, 300015, 510005, 500017, 710007, 700019, 910009, 900021, 120011, 110023, 320013, 310025, 520015, 510027, 720017, 710029, 920019, 910031, 130021, 120033, 330023, 320035, 530025, 520037, 730027, 720039, 930029, 920041, 140031
Offset: 1

Views

Author

Klaus Brockhaus, Jun 11 2006

Keywords

Comments

Let T(S,Q) be the sequence obtained by starting with S and repeatedly reversing the digits and adding Q to get the next term. This is T(100013,2). 100013 is the first S for which T(S,2) reaches a cycle of length 1890. The cycle is simply the first 1890 terms, which then repeat. A full period is given in the table.

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits[Reverse[IntegerDigits[#]]]+2&,100013,30] (* Harvey P. Dale, Oct 03 2014 *)

A120217 Start with 100057 and repeatedly reverse the digits and add 2 to get the next term.

Original entry on oeis.org

100057, 750003, 300059, 950005, 500061, 160007, 700063, 360009, 900065, 560011, 110067, 760013, 310069, 960015, 510071, 170017, 710073, 370019, 910075, 570021, 120077, 770023, 320079, 970025, 520081, 180027, 720083, 380029, 920085, 580031
Offset: 1

Views

Author

Klaus Brockhaus, Jun 11 2006

Keywords

Comments

Let T(S,Q) be the sequence obtained by starting with S and repeatedly reversing the digits and adding Q to get the next term. This is T(100057,2). 100057 is the first S for which T(S,2) reaches a cycle of length 945. The cycle is simply the first 945 terms, which then repeat. A full period is given in the table.

Crossrefs

A120218 Start with 100103 and repeatedly reverse the digits and add 2 to get the next term.

Original entry on oeis.org

100103, 301003, 300105, 501005, 500107, 701007, 700109, 901009, 900111, 111011, 110113, 311013, 310115, 511015, 510117, 711017, 710119, 911019, 910121, 121021, 120123, 321023, 320125, 521025, 520127, 721027, 720129, 921029, 920131, 131031
Offset: 1

Views

Author

Klaus Brockhaus, Jun 11 2006

Keywords

Comments

Let T(S,Q) be the sequence obtained by starting with S and repeatedly reversing the digits and adding Q to get the next term. This is T(100103,2). 100103 is the first S for which T(S,2) reaches a cycle of length 900. The cycle is simply the first 900 terms, which then repeat. A full period is given in the table.

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits[Reverse[IntegerDigits[#]]]+2&,100103,30] (* Harvey P. Dale, Aug 14 2012 *)

A120215 Start with 1057 and repeatedly reverse the digits and add 2 to get the next term.

Original entry on oeis.org

1057, 7503, 3059, 9505, 5061, 1607, 7063, 3609, 9065, 5611, 1167, 7613, 3169, 9615, 5171, 1717, 7173, 3719, 9175, 5721, 1277, 7723, 3279, 9725, 5281, 1827, 7283, 3829, 9285, 5831, 1387, 7833, 3389, 9835, 5391, 1937, 7393, 3939, 9395, 5941, 1497, 7943, 3499, 9945, 5501
Offset: 1

Views

Author

Klaus Brockhaus, Jun 11 2006

Keywords

Comments

Let T(S,Q) be the sequence obtained by starting with S and repeatedly reversing the digits and adding Q to get the next term. This is T(1057,2). 1057 is the first S for which T(S,2) reaches a cycle of length 45. The cycle is simply the first 45 terms, which then repeat. A full period is shown.

Crossrefs

Programs

  • Mathematica
    NestList[IntegerReverse[#]+2&,1057,50] (* Harvey P. Dale, Jan 25 2021 *)

Formula

a(n) = a(n-45). - Boštjan Gec, Sep 21 2023

A118516 Where records occur in A118514.

Original entry on oeis.org

1, 2, 12, 15, 25, 32, 102, 105, 111, 295, 392, 1002, 1918, 2187, 5812, 10009, 10011, 29995, 39992, 100002, 199918, 219987, 589912, 1000009, 1000011, 2999995, 3999992, 10000002, 19999918, 21999987, 58999912, 100000009
Offset: 1

Views

Author

N. J. A. Sloane, May 06 2006

Keywords

Comments

All terms so far enter the cycle of length 81, cf. A117521. - Klaus Brockhaus, Jun 12 2006

Crossrefs

Programs

  • C
    See Links section.
    
  • Python
    # See linked program in A118514.

Extensions

a(10) to a(25) from Klaus Brockhaus, Jun 12 2006
a(26) to a(32) from Rémy Sigrist, Aug 13 2022
Showing 1-10 of 11 results. Next