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).
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
Examples
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).
Programs
-
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 *)
Comments