OFFSET
1,2
COMMENTS
Or number of Fibonacci numbers in the trajectory of n under the 3x+1 map (i.e. the number of Fibonacci numbers until the trajectory reaches 1).
EXAMPLE
The finite sequence n, f(n), f(f(n)), ...., 1 for n = 9 is: 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 which has six Fibonacci numbers {1, 2, 5, 8, 13, 34}. Hence a(9) = 6.
MATHEMATICA
s = Fibonacci /@ Range@ 20; Table[Length@ Select[Union@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # != 1 &], MemberQ[s, #] &], {n, 120}] (* Michael De Vlieger, Aug 07 2016 *)
PROG
(PARI) print1(1, ", "); for(n=2, 100, s=n; t=1; while(s!=1, if(issquare(5*s^2+4) ||issquare(5*s^2-4), t++, t=t); if(s%2==0, s=s/2, s=(3*s+1)); if(s==1, print1(t, ", "); ); ))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michel Lagneau, Aug 07 2016
STATUS
approved