OFFSET
1,3
COMMENTS
Equivalently, numbers k such that k has an odd number of 1's in binary if and only if k is odd. - Aaron Weiner, Jun 19 2013
Numbers k with an even number of trailing zeros in the binary representation of k!, A011371(k). - Amiram Eldar, Sep 05 2024
REFERENCES
E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 111.
R. K. Guy, Impartial games, pp. 35-55 of Combinatorial Games, ed. R. K. Guy, Proc. Sympos. Appl. Math., 43, Amer. Math. Soc., 1991.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
J.-P. Allouche and J. Shallit, The Ring of k-regular Sequences, II, Theoret. Computer Sci., 307 (2003), 3-29.
FORMULA
Union of 2*A001969 and 2*A001969+1. With initial index 0: a(2n+1) = a(2n)+1, a(4n) = a(2n)+4n, a(4n+2) = -a(2n)+12n+6. - Ralf Stephan, Oct 17 2003
Conjecture: a(n) = 2*n + (-1)^(n-A000120(n-1)) - (3+(-1)^n)/2. - Velin Yanev, Dec 21 2016
EXAMPLE
G.f. = x + 6*x^2 + 7*x^3 + 10*x^4 + 11*x^5 + 12*x^6 + 13*x^7 + 18*x^8 + ...
MATHEMATICA
Select[Range[0, 150], EvenQ[Count[Most[IntegerDigits[#, 2]], 1]]&] (* Harvey P. Dale, Nov 03 2011 *)
a[ n_] := Which[ n < 1, 0, Mod[n, 2] > 0, a[n - 1] + 1, Mod[n, 4] > 0, 3 n - a[n/2 - 1], True, n + a[n/2]]; (* Michael Somos, Dec 21 2016 *)
PROG
(PARI) a(n)=if(n<1, 0, if(n%2==0, if(n%4==0, a(n/2)+n, -a((n-2)/2)+3*n), a(n-1)+1)) \\ Ralf Stephan
(PARI) is(n)=hammingweight(n>>1)%2==0 \\ Charles R Greathouse IV, Jun 19 2013
(Haskell)
a006364 n = a006364_list
a006364_list = filter (even . a000120. (`div` 2)) [0..]
-- Reinhard Zumkeller, Oct 03 2011
CROSSREFS
KEYWORD
base,nonn,nice,easy
AUTHOR
STATUS
approved