OFFSET
1,4
LINKS
FORMULA
a(2^m) = m.
MAPLE
nn:=100:
for n from 1 to nn do:
m:=n:it0:=0:it1:=0:
for j from 1 to 1000 while(m<>1) do:
if irem(m, 2)=0
then
m:=m/2:it0:=it0+1:
else
m:=3*m+1:it1:=it1+1:
fi:
od:
q:=gcd(it0, it1):printf(`%d, `, q):
od:
MATHEMATICA
Table[GCD[Count[NestWhileList[If[OddQ@ #, 3 # + 1, #/2] &, n, # > 1 &], _?EvenQ], Count[Differences[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &]], _?Positive]], {n, 87}] (* Michael De Vlieger, Oct 13 2016, after Harvey P. Dale at A006666 and A006667 *)
PROG
(PARI) a(n) = {my(se = 0); my(so = 0); while (n!=1, if (n % 2, so++; n = 3*n+1, se++; n = n/2); ); gcd(se, so); } \\ Michel Marcus, Oct 13 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Oct 11 2016
STATUS
approved