|
|
A347140
|
|
A tag automaton (see the Comments section).
|
|
0
|
|
|
35, 87, 471, 155, 38, 24, 88, 28, 4, 35, 30, 7, 32, 3, 25, 35, 15, 7, 200, 0, 15, 37, 405, 115, 11, 68, 585, 309, 115, 0, 42, 144, 27, 17, 7, 247, 292, 94, 132, 0, 46, 56, 112, 67, 80, 411, 319, 80, 89, 0, 16, 46, 180, 330, 44, 193, 213, 99, 326, 0, 6, 290, 172, 98, 540
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Start with any positive integer K. At each step, add the first two digits and append the sum to the end, then remove the first digit to obtain the new state. Iterate until K reappears, and then a(K) is the number of steps until K reappears. (Definition corrected by Allan Wechsler.)
If K never reappears, a(K) = 0.
As we need at least two digits to start the procedure, we decide that a(1) to a(9) are to be written as 01, 02, 03, 04, 05, 06, 07, 08 and 09.
Conjecture: a(K) = 0 if K contains any of the substrings '00', '20', '30', '40', '50', '60', '70', '80', or '90', or the substrings '132', '232', '356', '358', '532', '534', '632', '634', '635', '656', '732', '734', '832', '834', '835', '932', '934', '935', or '958'. - Hans Havermann, Aug 21 2021
|
|
LINKS
|
|
|
EXAMPLE
|
09 is successively transformed as follows:
09
.99
..918
...1810
....8109
and 09 reappears after 4 steps, so a(9) = 4.
10 will be successively transformed as follows:
10
.01
..11
...12
....23
.....35
......58
.......813
........139
.........394
..........9412
...........41213
............12135 etc.
The full string (without erasures) after 35 steps is:
10112358139412135334886712161413833775541111610, and "10" has reappeared, ending the procedure. The next digit is 1, so starting at "01" (line 2) would also take 35 steps for "01" to reappear. Hence a(1) = 35.
a(735) = 3213292, where the full string contains 4143987 digits.
|
|
MATHEMATICA
|
g[n_]:=Join[Rest@n, IntegerDigits@Total[n[[;; 2]]]]; Table[k=If[Mod[k, 10]==0, If[Mod[k, 100]==10, k, 0], k];
If[k==0, 0, d=g@If[k<10, b=""<>{"0", ToString@k}; Join[{0}, {k}], b=ToString@k; IntegerDigits@k];
Length@NestWhileList[g@#&, d, !StringContainsQ[ToString@FromDigits@#,
|
|
PROG
|
(Python)
def delta(s): return str(int(s[0]) + int(s[1]))
def a(n):
if n%10 == 0 and n%100 != 10: return 0
s = "0"*(n < 10) + str(n)
i, target, nexts = 1, s[:], delta(s[:2])
s = s[1:] + nexts
while target not in s:
nexts = delta(s[:2])
s = s[1:] + nexts
i += 1
return i
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|