OFFSET
1,2
COMMENTS
If the Collatz 3n+1 conjecture is true, then this is a permutation of all positive integers. See A261715 for putative inverse.
LINKS
MAPLE
a:= proc() local a, b, s; b, s:= proc() true end,
heap[new]((x, y)-> is(x>y), 1); a:=
proc(n) option remember; local k, t;
if n>1 then a(n-1) fi;
t:= heap[extract](s); b(t):= false;
k:= 2*t; if b(k) then heap[insert](k, s) fi;
if irem(t-1, 3, 'k')=0 and (k::odd) and
b(k) then heap[insert](k, s) fi; t
end
end():
seq(a(n), n=1..80); # Alois P. Heinz, Aug 29 2015
PROG
(Perl) See Links section.
(C++) See Links section.
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Paul Tek, Aug 28 2015
STATUS
approved