login
A348340
For n >= 1; x = n, then iterate x --> x + h(x) until h(x + h(x)) >= h(x). a(n) gives the number of iteration steps where h(i) is A000120(i).
0
5, 4, 3, 3, 2, 1, 1, 4, 3, 3, 2, 2, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 5, 3, 4, 2, 2, 3, 3, 1, 2, 2, 2, 1, 1, 1, 1, 1, 7, 6, 6, 5, 5, 1, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 5, 3, 4, 2, 2, 3, 3, 1, 2, 2, 2, 1, 1, 1, 1, 1, 5, 3, 4, 2, 2, 3, 4, 1, 2, 2, 3, 1, 1, 1, 2
OFFSET
1,1
COMMENTS
a(n) = 1 for n such that A000120(n + A000120(n)) < A000120(n).
EXAMPLE
n = 19; x(1) = 19 + h(19) = 22, h(22) >= h(19) thus x(2) = 22 + h(22) = 25, h(25) >= h(22) thus x(3) = 25 + h(25) = 28, h(28) >= h(25) thus x(4) = 28 + h(28) = 31, h(31) >= h(28) thus x(5) = 31 + h(31) = 36, h(36) < h(31) thus stop. a(19) = 5. h(i) is A000120(i).
MATHEMATICA
h[n_] := DigitCount[n, 2, 1]; x[n_] := n + h[n]; a[n_] := Length@ NestWhileList[x, n, h[#] <= h[x[#]] &]; Array[a, 110] (* Amiram Eldar, Oct 15 2021 *)
CROSSREFS
Sequence in context: A132669 A276052 A374420 * A321028 A351169 A263356
KEYWORD
nonn,base
AUTHOR
Ctibor O. Zizka, Oct 13 2021
STATUS
approved