login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Let L_n be the infinite sequence formed by starting with 1 and repeatedly placing the first digit at the end of the number and adding n to get the next term. If L_n eventually reaches a cycle, sequence gives length of that cycle, otherwise -1.
2

%I #11 Dec 26 2017 17:18:54

%S 9,9,3,9,18,3,18,9,1,18,9,6,9,18,6,18,9,1,18,36,9,18,18,9,18,9,3,18,

%T 36,9,18,27,3,18,9,3,45,36,6,9,27,12,27,18,3,72,36,9,9,27,9,27,18,3,

%U 99,27,9,45,27,9,27,18,3,27,27,9,45,27,9,27,18,3,27,27,9,54,27,9,27,36,3,27

%N Let L_n be the infinite sequence formed by starting with 1 and repeatedly placing the first digit at the end of the number and adding n to get the next term. If L_n eventually reaches a cycle, sequence gives length of that cycle, otherwise -1.

%C It is conjectured that L_n always reaches a cycle.

%C From _Robert Israel_, Dec 26 2017: (Start)

%C It always reaches a cycle. Suppose d = A055642(n).

%C If L_n(k) < 10^(d+1) + 10^d, then L_n(k+1) < 10^(d+1) + n < 10^(d+1) + 10^d. Thus the sequence L_n is bounded, and always reaches a cycle.

%C Moreover, a(n) <= 11*10^A055642(n). (End)

%C From _Robert Israel_, Dec 25 2017: (Start)

%C a(10^k-1) = 1 for k >= 1.

%C a(19*10^k-1) = 1.

%C Empirical:

%C a(10^k) = 9*(k+1).

%C a(2*10^k) = 9*(k+1)^2.

%C a(2*10^k-1) = 9*(k+1).

%C a(10^k+1) = 9*(k+1) for k >= 2.

%C a(2*10^k+1) = 3*(k+2) for k >= 1. (End)

%H Robert Israel, <a href="/A118739/b118739.txt">Table of n, a(n) for n = 1..10000</a>

%e L_5 = [1,6,11,16,66,71,22,27,77,82,33,38,88,93,44,49,99,104,46,69,101,16,...]

%e enters a cycle of length 18 after 3 steps.

%p h:= proc(n) local t, k, S,d;

%p t:= 1; S[t]:= 0;

%p for k from 1 do

%p d:= 10^ilog10(t);

%p t:= 10*(t mod d)+ floor(t/d) + n;

%p if assigned(S[t]) then return k-S[t] fi;

%p S[t]:= k;

%p od

%p end proc:

%p map(h, [$1..100]); # _Robert Israel_, Dec 25 2017

%t h[n_] := Module[{t, k, S, d}, t = 1; S[_] = 0; For[k = 1, True, k++, d = 10^Floor[Log[10, t]]; t = 10*Mod[t, d] + Floor[t/d] + n; If[S[t] != 0, Return[k - S[t]]]; S[t] = k]];

%t Array[h, 100] (* _Jean-François Alcover_, Dec 26 2017, after _Robert Israel_ *)

%Y Cf. A055642, A118740.

%K base,nonn

%O 1,1

%A Luc Stevens (lms022(AT)yahoo.com), May 24 2006

%E Corrected by _Robert Israel_, Dec 25 2017