OFFSET
0,3
COMMENTS
Column 2 of A050600: a(n) = add1c(n,2).
Absolute values of A094267.
Consider the Collatz (or 3x+1) problem and the iterative sequence c(k) where c(0)=n is a positive integer and c(k+1)=c(k)/2 if c(k) is even, c(k+1)=(3*c(k)+1)/2 if c(k) is odd. Then a(n) is the minimum number of iterations in order to have c(a(n)) odd if n is even or c(a(n)) even if n is odd. - Benoit Cloitre, Nov 16 2001
LINKS
James Spahlinger, Table of n, a(n) for n = 0..10000
Cristian Cobeli, Mihai Prunescu, and Alexandru Zaharescu, A growth model based on the arithmetic Z-game, arXiv:1511.04315 [math.NT], 2015.
Francis Laclé, 2-adic parity explorations of the 3n+ 1 problem, hal-03201180v2 [cs.DM], 2021.
FORMULA
Equals A053398(2, n).
G.f.: (1+x)/x^2 * Sum(k>=1, x^(2^k)/(1-x^(2^k))). - Ralf Stephan, Apr 12 2002
a(n) = A136480(n+1). - Reinhard Zumkeller, Dec 31 2007
a(n) = A007814(n + 2 - n mod 2). - James Spahlinger, Oct 11 2013, corrected by Charles R Greathouse IV, Oct 14 2013
a(2n) = a(2n+1). 1 <= a(n) <= log_2(n+2). - Charles R Greathouse IV, Oct 14 2013
a(n) = (-1)^n * A094267(n). - Michael Somos, May 11 2014
a(n) = A007814(floor(n/2)+1). - Chai Wah Wu, Jul 07 2022
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=0..m} a(k) = 2. - Amiram Eldar, Sep 15 2022
MATHEMATICA
With[{c=Table[Position[Reverse[IntegerDigits[n, 2]], 1, 1, 1], {n, 110}]// Flatten}, Riffle[c, c]] (* Harvey P. Dale, Dec 06 2018 *)
PROG
(PARI) a(n)=valuation(n+2-n%2, 2) \\ Charles R Greathouse IV, Oct 14 2013
(PARI) {a(n) = my(A); if( n<0, 0, A = sum(k=1, length( binary(n+2)) - 1, x^(2^k) / (1 - x^(2^k)), x^3 * O(x^n)); polcoeff( A * (1 + x) / x^2, n))}; /* Michael Somos, May 11 2014 */
(Python)
def A050603(n): return ((m:=n>>1)&~(m+1)).bit_length()+1 # Chai Wah Wu, Jul 07 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Antti Karttunen Jun 22 1999
EXTENSIONS
Definition simplified by N. J. A. Sloane, Aug 27 2016
STATUS
approved