OFFSET
1,3
COMMENTS
This is A006577 with duplicates removed.
This is a permutation of the nonnegative integers.
LINKS
MAPLE
collatz:= proc(n) option remember; `if`(n=1, 0,
1 + collatz(`if`(n::even, n/2, 3*n+1)))
end:
b:= proc() 0 end:
g:= proc(n) option remember; local t;
`if`(n=1, 0, g(n-1));
t:= collatz(n); b(t):= b(t)+1
end:
h:= proc(n) option remember; local k; for k
from 1+h(n-1) while g(k)>1 do od; k
end: h(0):=0:
a:= n-> collatz(h(n)):
seq(a(n), n=1..100);
MATHEMATICA
collatz[n_] := collatz[n] = If[n==1, 0,
1 + collatz[If[EvenQ[n], n/2, 3n+1]]];
b[_] = 0;
g[n_] := g[n] = Module[{t}, If[n==1, 0, g[n-1]];
t = collatz[n]; b[t] = b[t]+1];
h[n_] := h[n] = Module[{k}, For[k = 1+h[n-1],
g[k]>1, k++]; k]; h[0] = 0;
a[n_] := a[n] = collatz[h[n]];
Array[a, 100] (* Jean-François Alcover, Jan 30 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Jan 27 2021
STATUS
approved