OFFSET
1,9
COMMENTS
LINKS
Michel Lagneau, Table of n, a(n) for n = 1..10000
EXAMPLE
MAPLE
A:= proc(n) if type(n, 'even') then n/2; else 3*n+1 ; end if; end proc:
B:= proc(n) a := 0 ; x := n ; while x > 1 do x := A(x) ; a := a+1 ; end do; a ; end proc:
C:= proc(n) a := 0 ; x := n ; while x > 1 do if type(x, 'even') then x := x/2 ; else x := 3*x+1 ; a := a+1 ; end if; end do; a ; end proc:
D:= proc(n) C(n) ; end proc:
A006666:= proc(n) B(n)- C(n) ; end:
A006667:= proc(n) C(n)- D(n) ; end:
for i from 1 to 100 do: printf(`%d, `, G(i)-i):od:
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 100; t = {}; n = 0; While[Length[t] < nn, n++; c = Collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; AppendTo[t, Floor[2^ev/3^od]-n]]; t
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Apr 27 2013
STATUS
approved