OFFSET
1,2
REFERENCES
L. Flatto, Z-numbers and beta-transformations, in Symbolic dynamics and its applications (New Haven, CT, 1991), 181-201, Contemp. Math., 135, Amer. Math. Soc., Providence, RI, 1992.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
K. Mahler, An unsolved problem on the powers of 3/2, J. Austral. Math. Soc. 8 (1968), pp. 313-321.
FORMULA
For odd n: a(n)=A007814(n+1), for even n: A007814(n) steps until an odd number is reached, which leads directly to the formula: with b(n)=A007814(n) (binary carry sequence) a(n)=b(n)+b((3^b(n)*n/2^b(n)+1)/2) - Lambert Herrgesell (zero815(AT)googlemail.com) and Lambert Klasen (lambert.klasen(AT)gmx.net), Apr 24 2006. Hence in particular, a(n) is well-defined.
EXAMPLE
8 -> 12 -> 18 -> 27 -> 41 takes 4 steps so a(8) = 4.
MATHEMATICA
Table[Length[NestWhileList[If[EvenQ[#], (3#)/2, (3#+1)/2]&, n, Mod[#, 4]!= 1&]]-1, {n, 110}] (* Harvey P. Dale, Jul 06 2011 *)
PROG
(PARI) {stop=1000; for(n=1, 105, c=0; k=n; while((k%4)!=1&&c<stop, k=if(k%2==0, 3*k/2, (3*k+1)/2); c++); print1(if(c<stop, c, -1), ", "))}
(PARI) b(n)=valuation(n, 2); a(n)=b(n)+b((3^b(n)*n/2^b(n)+1)/2) - Lambert Herrgesell (zero815(AT)googlemail.com) and Lambert Klasen (lambert.klasen(AT)gmx.net), Apr 24 2006
(Haskell)
a063574 n = fst $ until ((== 1) . flip mod 4 . snd)
(\(u, v) -> (u + 1, a007494 v)) (0, n)
-- Reinhard Zumkeller, Dec 13 2014
CROSSREFS
KEYWORD
easy,nice,nonn
AUTHOR
N. J. A. Sloane, Sep 23 2002
EXTENSIONS
Extended by Klaus Brockhaus, Sep 23 2002
STATUS
approved