%I #8 Feb 28 2013 16:16:19
%S 0,0,0,0,0,0,0,0,0,0,0,0,7,0,9,0,0,0,16,0,5,0,9,0,0,0,0,0,16,9,0,0,0,
%T 0,9,0,19,16,0,0,0,0,0,0,14,9,0,0,0,16,20,0,9,0,106,0,0,0,0,0,17,0,95,
%U 0,0,16,23,0,12,9,0,0,0,0,0,0,20,0,27,0,0,0
%N For the Collatz (3x+1) iteration starting at n, number of integers k such that T(n,k) = T(n-1,k) where T(n,k) is the k-th number of the trajectory.
%H Michel Lagneau, <a href="/A213186/b213186.txt">Table of n, a(n) for n = 1..10000</a>
%e a(13) = 7 because the Collatz iterations starting at 13 and 12 are :
%e T(13,k) =[13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
%e T(12,k) =[12, 6, 3, 10, 5, 16, 8, 4, 2, 1] and the 7 common values with the same indices are :
%e T(13,4) = T(12,4) = 10 ;
%e T(13,5) = T(12,5) = 5 ;
%e T(13,6) = T(12,6) = 16 ;
%e T(13,7) = T(12,7) = 8 ;
%e T(13,8) = T(12,8) = 4 ;
%e T(13,9) = T(12,9) = 2 ;
%e T(13,10) = T(12,10) = 1.
%p nn:=200:T:=array(1..nn):U:=array(1..nn): aa:=1:
%p for i from 1 to nn do:
%p U[i]:=0:
%p od:
%p for n from 1 to nn do:
%p a:=0:k:=0:x:=n:
%p for i from 1 to 10^8 while (x>1) do:
%p if irem(x,2)=0 then
%p x := x/2:a:=a+1:k:=k+1:T[k]:=x:
%p else
%p x := 3*x+1: a := a+1: k:=k+1:T[k]:=x:
%p fi:
%p od:
%p it:=0:
%p for j from 1 to min(a,aa) do:
%p if T[j]=U[j] then
%p it:=it+1:
%p else
%p fi:
%p od:
%p for m from 1 to a do:
%p U[m]:=T[m]:
%p od:
%p aa:=a: printf(`%d, `,it):
%p od:
%Y Cf. A006577, A213185.
%K nonn
%O 1,13
%A _Michel Lagneau_, Feb 28 2013
|