OFFSET
0,3
COMMENTS
Fixed points of the process (numbers that reach themselves in a single step) are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1818, 17171, 272727, 1313131, 2626262, 3939393, 12121212, 24242424, 36363636, 48484848, etc.
The number of steps to return to the original number or to enter another cycle depends on the number of digits. Here below all possible steps against the number of digits from 1 to 8:
Digits Steps
1 1
2 3, 12
3 3, 9
4 1, 3, 10, 31
5 1, 9
6 1, 4, 13, 21, 39
7 1, 2, 4, 5, 6, 10, 12, 20, 23, 30, 60
8 1, 3, 26, 78
MAPLE
P:=proc(q) local a, b, c, d, k, n, x;
for n from 1 to q do a:=convert(n, base, 10); d:=a; x:=0;
while x<10^(ilog10(n)+1) do x:=x+1; b:=convert(a, `+`);
c:=ilog10(b)+1; b:=convert(b, base, 10);
for k from 1 to nops(a)-c do a[k]:=a[k+c]; od;
for k from 1 to c do a[nops(a)-c+k]:=b[k]; od;
if a=d then print(n); break; fi; od; od; end: P(10^6);
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Jun 19 2018
STATUS
approved