OFFSET
1,2
COMMENTS
Clearly the sequence is infinite and a(n) < 2^n. - Charles R Greathouse IV, May 25 2016
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
A025586(a(n)) = 2^j for some j.
MATHEMATICA
Coll[n_]:=NestWhileList[If[EvenQ[#], #/2, 3*#+1] &, n, #>1&]; t={}; Do[x = Max[Coll[n]]; If[IntegerQ[Log[2, x]], AppendTo[t, n]], {n, 90000}]; t (* Jayanta Basu, Apr 28 2013 *)
PROG
(Haskell)
a095381 n = a095381_list !! (n-1)
a095381_list = map (+ 1) $ elemIndices 1 $ map a209229 a025586_list
-- Reinhard Zumkeller, Apr 30 2013
(PARI) is(n)=my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n)); n>>=1); r>>valuation(r, 2)==1 \\ Charles R Greathouse IV, May 25 2016
(C) // Valid below A006884(47) = 12327829503 on 64-bit machines.
static long is (unsigned long n) {
unsigned long r = n;
n >>= __builtin_ctzl(n); // gcc builtin for A007814
while (n > 1) {
n = 3*n + 1;
if (n > r) r = n;
n >>= __builtin_ctzl(n);
}
return !(r & (r-1));
} // Charles R Greathouse IV, May 25 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Jun 14 2004
STATUS
approved