OFFSET
0,6
COMMENTS
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = a(A022290(n)) + 1, for n >= 4.
EXAMPLE
For n = 4 the trajectory is 4 -> 3. The number of iterations is 1, thus a(4) = 1.
For n = 6 the trajectory is 6 -> 5 -> 4 -> 3. The number of iterations is 3, thus a(6) = 3.
MATHEMATICA
f[n_] := f[n] = Module[{d = IntegerDigits[n, 2], nd}, nd = Length[d]; Total[d * Fibonacci[Range[nd + 1, 2, -1]]]]; (* A022290 *)
a[n_] := -2 + Length@ FixedPointList[f, n]; Array[a, 100, 0]
PROG
(PARI) f(n) = {my(b = binary(n), nb = #b); sum(i = 1, nb, b[i] * fibonacci(nb - i + 2)); } \\ A022290
a(n) = if(n < 4, 0, a(f(n)) + 1);
(Python)
def A364801(n):
if n<4: return 0
a, b, s = 1, 2, 0
for i in bin(n)[-1:1:-1]:
if int(i):
s += a
a, b = b, a+b
return A364801(s)+1 # Chai Wah Wu, Aug 10 2023
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Amiram Eldar, Aug 08 2023
STATUS
approved