OFFSET
1,1
COMMENTS
Recall that f(n) = n/2 if n is even; = 3n + 1 if n is odd.
EXAMPLE
n, f(n), f(f(n)), ...., 1 for n = 22, 21, 20, respectively, are: 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1; 21, 64, 32, 16, 8, 4, 2, 1; 20, 10, 5, 16, 8, 4, 2, 1. Hence h(22) = 16 = 8 + 8 = h(21) + h(20) and 22 belongs to the sequence.
MATHEMATICA
f[n_] := If[EvenQ[n], n/2, 3n+1]; h[n_] := Module[{a, i}, i=n; a=1; While[i>1, a++; i=f[i]]; a]; Select[Range[3, 19900], h[ # ]==h[ #-1]+h[ #-2]&]
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph L. Pe, Dec 29 2002
EXTENSIONS
Extended by Robert G. Wilson v, Dec 30 2002
STATUS
approved