f:= proc(n) global count; count := count +1; if n<>1 then if n mod 2 = 0 then f(n/2) else f(3*n+1); fi; else count; fi; end;