|
|
A118739
|
|
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
|
|
|
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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
It is conjectured that L_n always reaches a cycle.
It always reaches a cycle. Suppose d = A055642(n).
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.
Moreover, a(n) <= 11*10^A055642(n). (End)
a(10^k-1) = 1 for k >= 1.
a(19*10^k-1) = 1.
Empirical:
a(10^k) = 9*(k+1).
a(2*10^k) = 9*(k+1)^2.
a(2*10^k-1) = 9*(k+1).
a(10^k+1) = 9*(k+1) for k >= 2.
a(2*10^k+1) = 3*(k+2) for k >= 1. (End)
|
|
LINKS
|
|
|
EXAMPLE
|
L_5 = [1,6,11,16,66,71,22,27,77,82,33,38,88,93,44,49,99,104,46,69,101,16,...]
enters a cycle of length 18 after 3 steps.
|
|
MAPLE
|
h:= proc(n) local t, k, S, d;
t:= 1; S[t]:= 0;
for k from 1 do
d:= 10^ilog10(t);
t:= 10*(t mod d)+ floor(t/d) + n;
if assigned(S[t]) then return k-S[t] fi;
S[t]:= k;
od
end proc:
|
|
MATHEMATICA
|
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]];
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
Luc Stevens (lms022(AT)yahoo.com), May 24 2006
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|