This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A063574 #15 Dec 13 2014 03:01:58 %S A063574 0,2,1,2,0,1,2,4,0,4,1,3,0,1,3,4,0,2,1,2,0,1,2,3,0,3,1,7,0,1,4,6,0,2, %T A063574 1,2,0,1,2,5,0,6,1,3,0,1,3,5,0,2,1,2,0,1,2,3,0,3,1,4,0,1,5,6,0,2,1,2, %U A063574 0,1,2,4,0,4,1,3,0,1,3,4,0,2,1,2,0,1,2,3,0,3,1,5,0,1,4,5,0,2,1,2,0,1,2,7,0 %N A063574 Number of steps to reach an integer == 1 (mod 4) when iterating the map n -> 3n/2 if n even or (3n+1)/2 if n odd. %D A063574 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. %H A063574 Reinhard Zumkeller, <a href="/A063574/b063574.txt">Table of n, a(n) for n = 1..10000</a> %H A063574 K. Mahler, <a href="http://carmaweb.newcastle.edu.au/mahler/docs/167.pdf">An unsolved problem on the powers of 3/2</a>, J. Austral. Math. Soc. 8 (1968), pp. 313-321. %F A063574 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. %e A063574 8 -> 12 -> 18 -> 27 -> 41 takes 4 steps so a(8) = 4. %t A063574 Table[Length[NestWhileList[If[EvenQ[#],(3#)/2,(3#+1)/2]&,n, Mod[#,4]!= 1&]]-1,{n,110}] (* _Harvey P. Dale_, Jul 06 2011 *) %o A063574 (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),","))} %o A063574 (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 %o A063574 (Haskell) %o A063574 a063574 n = fst $ until ((== 1) . flip mod 4 . snd) %o A063574 (\(u, v) -> (u + 1, a007494 v)) (0, n) %o A063574 -- _Reinhard Zumkeller_, Dec 13 2014 %Y A063574 Cf. A007494. %K A063574 easy,nice,nonn %O A063574 1,2 %A A063574 _N. J. A. Sloane_, Sep 23 2002 %E A063574 Extended by _Klaus Brockhaus_, Sep 23 2002