OFFSET
0,1
COMMENTS
There are only four eventual cycles as cited in A306979:
- (148, 274) (length = 2);
- (98, 768, 448, 288, 516) (length = 5);
- (70, 129, 518, 290, 517, 162) (length = 6);
- (5, 32, 12, 6, 64, 80, 257, 164, 82, 260, 69, 576, 224, 24, 20) (length = 15).
First occurrence of length k or -1 if no such length occurs for k=2,3,4,...: 148, 184, 1578, 98, 29, 126, 67, 106, 57, 299, 2399, -1, -1, 5, 21, 15, 47, 136, 37, 48, 39, 38, 18, 9, 30, 27, 36, 25, 7, 16, 4, 2, 1, 0, 3, 10, 13, 203, 68, 26, 134, 127, 2357, ..., .
EXAMPLE
a(0) = 35 since the mapping as described in A306979 is that sequence's first 35 terms;
a(1) = 34 since it is the sequence above less the first term;
a(2) = 33 since it is the sequence above less the first two terms;
a(29) = 6 since the sequence is {29 -> 516 -> 98 -> 768 -> 448 -> 288 -> 516 -> ...};
a(184) = 3 since the sequence is {184 -> 274 -> 148 -> 274}; etc.
MATHEMATICA
g[n_] := Plus @@ (2^IntegerDigits@ n); f[n_] := Length[ NestWhileList[ g@# &, n, UnsameQ, All]] - 1; Array[f, 70, 0]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jianing Song and Robert G. Wilson v, Apr 11 2019
STATUS
approved