%I #40 Nov 22 2015 22:10:19
%S 2,2,3,6,3,3,7,42,7,73,39,288,27,27,135,1974,1419,861,2787,13530,7297,
%T 5247,33963,92736,100033,161857,116395
%N For the Collatz (3x+1) iteration starting at k, the sequence lists the smallest k such that Fibonacci(n) belongs to the trajectory of k, or 0 if no such k exists.
%C The initial term k is not counted as an element of the trajectory.
%e a(1)=a(2)=2 because 1 = Fibonacci(1)=Fibonacci(2) is in the trajectory 2 -> 1;
%e a(3)=3 because 2 = Fibonacci(3) is in the trajectory 3 -> 10 -> 5 -> ... -> 2 ->1;
%e a(4)=6 because 7 = Fibonacci(4)=3 is in the trajectory 6 -> 3 -> 10 -> ... -> 1;
%e a(5)=3 because 5 = Fibonacci(5)=3 is in the trajectory 3 -> 10 -> 5 -> ... -> 1.
%e a(6)=3 because 8 = Fibonacci(6)=3 is in the trajectory 3 -> 10 -> 5 -> 16 -> 8 -> ... -> 1;
%e a(7)=7 because 13 = Fibonacci(7)=3 is in the trajectory 7 -> 22 -> 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> ... -> 1.
%p with(numtheory):with(combinat,fibonacci):
%p for n from 1 to 10000 do:
%p jj:=0:
%p for k from 2 to 10^8 while(jj=0) do:
%p lst:={}:m:=k:ii:=0:it:=10^6:
%p for i from 1 to it while(ii=0) do:
%p if irem(m,2)=0
%p then
%p m:=m/2:
%p else m:=3*m+1:
%p fi:
%p lst:=lst union {m}:
%p if m=1
%p then
%p ii:=1:
%p else
%p fi:
%p od:
%p n0:=nops(lst):
%p for j from 1 to n0 while(jj=0)do:
%p if fibonacci(n)=lst[j]
%p then
%p jj:=1:
%p else fi:
%p od:
%p if jj=1 then printf("%d %d \n",n,k):
%p else fi:
%p od:od:
%Y Cf. A000045, A006577.
%K nonn,hard
%O 1,1
%A _Michel Lagneau_, Nov 22 2015