%I #9 Dec 10 2016 19:41:15
%S 8,9,16,10,5,17,5,11,36,5,5,18,24,5,42,12,25,37,12,5,10,5,11,19,19,25,
%T 31,5,37,43,17,13,173,26,32,34,38,13,44,5,44,11,50,6,17,12,56,20,85,
%U 20,20,26,26,32,32,6,32,38,12,44,15,18,18,14,21,174,20,27
%N Number of steps needed to enter the cycle in the double '5x+1' and '3x+1' problem.
%C See A264811 for the double '3x+1' and '5x+1' problem.
%C The double '5x+1' and '3x+1' problem is as follows: start with any number n.
%C Step 1: if n is even, divide it by 2 until the result becomes odd, otherwise multiply it by 5 and add 1. Let r1 denote the result after respective computation.
%C Step 2: if the result r1 of step 1 is even, divide it by 2 until the result becomes odd, and then multiply it by 3 and add 1. If the result of step 1 is odd, multiply it by 3 and add 1. Let r2 denote the result after respective computation.
%C Step 3: go to step 1 with n=r2 and continue until stabilization.
%C It is conjectured that the process always stabilize.
%C Starting from any positive n, we call the sequence of iterates (n, T(n,1), T(n,2), ..., T(n,k), ...) the trajectory of n. There are three possible behaviors for such trajectories when n>0:
%C (i) Convergent trajectory. Some T(n,k) = 1.
%C (ii) Nontrivial cyclic trajectory. The sequence T(n,k) eventually becomes periodic and T(n,k) is different from 1 for any k>=1.
%C (iii) Divergent trajectory (it is conjectured that this behavior cannot occur).
%H Michel Lagneau, <a href="/A265221/b265221.txt">Table of n, a(n) for n = 1..10000</a>
%e a(1)=8 because the number 1 generates the trajectory with 8 steps 1 -> 6 -> 3 -> 10 -> 5 -> 26 -> 13 -> 40 -> 20 where the number 20 is the last term of the cycle because the following terms 20/2 = 10 -> 5 -> 26 -> 13 -> 40 are already in the trajectory.
%p for n from 1 to 100 do:nn:=1000:T:=array(1..nn):kk:=1:
%p lst:={n}:m:=n:it:=0:indic:=0:m0:=n:T[1]:=n:
%p for i from 2 to nn do:
%p if irem(m,2)=0
%p then m:=m/2:kk:=kk+1:T[kk]:=m:lst:=lst union {m}:it:=it+1:
%p else
%p if indic=0
%p then m:=5*m+1:kk:=kk+1:T[kk]:=m:lst:=lst union {m}:it:=it+1:indic:=1:
%p else
%p m:=3*m+1:it:=it+1:kk:=kk+1:T[kk]:=m:lst:=lst union {m}:indic:=0:
%p fi:
%p fi:
%p od:
%p n0:=nops(lst):ii:=0:
%p for a from n0 to nn while (ii=0) do:
%p q:=T[a]:it:=0:
%p for b from a-1 by -1 to 1 while (ii=0)do:
%p it:=it+1:
%p if q=T[b] and q=T[b+it]
%p then
%p ii:=1: printf(`%d, `,a-2):
%p else
%p fi:
%p od:
%p od:
%p od:
%Y Cf. A006577, A264811.
%K nonn
%O 1,1
%A _Michel Lagneau_, Dec 05 2015
|