login
A305669
Take the sum of the digits of a number, put it at the left side and delete the same number of digits at the right side. Repeat the process. Sequence lists numbers that reach themselves after some steps.
0
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 17, 21, 32, 41, 51, 53, 54, 65, 81, 85, 95, 98, 101, 108, 109, 116, 171, 179, 210, 321, 632, 811, 910, 917, 1013, 1071, 1112, 1113, 1114, 1116, 1271, 1291, 1312, 1313, 1315, 1316, 1323, 1375, 1381, 1415, 1516, 1517, 1585
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
Cf. A007953.
Sequence in context: A318736 A050741 A285710 * A325364 A133810 A176615
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Jun 19 2018
STATUS
approved