OFFSET
1,7
COMMENTS
T(n,k) is periodic, for example
T(6,3) = 10 and T(7,3) = 11;
T(10,3) = 16 and T(11,3) = 17,
…………..
T(6+4m, 3) = 10 + 6m and T(6+4m+1, 3) = 10 + 6m+1.
.................
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
a(7) = 2 because the Collatz iterations starting at 7 and 6 are :
T(7,k) =[7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]
T(6,k) =[6, 3, 10, 5, 16, 8, 4, 2, 1] ; the number 7 is not counted
=> T(7,3) = T(6,3) + 1 and T(7,5) = T(6,5) + 1, hence a(7) = 2.
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]+1 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