OFFSET
1,13
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
a(13) = 7 because the Collatz iterations starting at 13 and 12 are :
T(13,k) =[13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
T(12,k) =[12, 6, 3, 10, 5, 16, 8, 4, 2, 1] and the 7 common values with the same indices are :
T(13,4) = T(12,4) = 10 ;
T(13,5) = T(12,5) = 5 ;
T(13,6) = T(12,6) = 16 ;
T(13,7) = T(12,7) = 8 ;
T(13,8) = T(12,8) = 4 ;
T(13,9) = T(12,9) = 2 ;
T(13,10) = T(12,10) = 1.
MAPLE
nn:=200:T:=array(1..nn):U:=array(1..nn): aa:=1:
for i from 1 to nn do:
U[i]:=0:
od:
for n from 1 to nn do:
a:=0:k:=0:x:=n:
for i from 1 to 10^8 while (x>1) do:
if irem(x, 2)=0 then
x := x/2:a:=a+1:k:=k+1:T[k]:=x:
else
x := 3*x+1: a := a+1: k:=k+1:T[k]:=x:
fi:
od:
it:=0:
for j from 1 to min(a, aa) do:
if T[j]=U[j] then
it:=it+1:
else
fi:
od:
for m from 1 to a do:
U[m]:=T[m]:
od:
aa:=a: printf(`%d, `, it):
od:
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 28 2013
STATUS
approved