login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A059009 Numbers having an odd number of zeros in their binary expansion. 13
0, 2, 5, 6, 8, 11, 13, 14, 17, 18, 20, 23, 24, 27, 29, 30, 32, 35, 37, 38, 41, 42, 44, 47, 49, 50, 52, 55, 56, 59, 61, 62, 65, 66, 68, 71, 72, 75, 77, 78, 80, 83, 85, 86, 89, 90, 92, 95, 96, 99, 101, 102, 105, 106, 108, 111, 113, 114, 116, 119, 120, 123, 125, 126, 128, 131 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

LINKS

Indranil Ghosh, Table of n, a(n) for n = 0..25000 (terms 0..1000 from T. D. Noe)

FORMULA

a(0) = 0, a(2n) = -a(n) + 6n + 1, a(2n+1) = a(n) + 2n + 2. a(n) = 2n + 1/2(1-(-1)^A023416(n)) = 2n + A059448(n). - Ralf Stephan, Sep 17 2003

EXAMPLE

18 is in the sequence because 18 = 10010_2. '10010' has three zeros. - Indranil Ghosh, Feb 04 2017

MAPLE

a:= proc(n) option remember;

  if n::even then -a(n/2) + 3*n + 1 else a((n-1)/2) + n + 1 fi

end proc:

a(0):= 0:

seq(a(n), n=0..100); # Robert Israel, Feb 23 2016

MATHEMATICA

Select[Range[0, 150], OddQ[Count[IntegerDigits[#, 2], 0]]&] (* Harvey P. Dale, Oct 22 2011 *)

PROG

(PARI) is(n)=hammingweight(bitneg(n, #binary(n)))%2 \\ Charles R Greathouse IV, Mar 26 2013

(Haskell)

a059009 n = a059009_list !! (n-1)

a059009_list = filter (odd . a023416) [1..]

-- Reinhard Zumkeller, Jan 21 2014

(Python)

i=j=0

while j<=25000:

....if bin(i)[2:].count("0")%2==1:

........print str(j)+" "+str(i)

........j+=1

....i+=1 # Indranil Ghosh, Feb 04 2017

(R)

maxrow <- 4 # by choice

onezeros <- 1

for(m in 1:(maxrow+1)){

  row <- onezeros[2^(m-1):(2^m-1)]

  onezeros <- c(onezeros, c(1-row, row) )

}

a <- which(onezeros == 0)

a

# Yosu Yurramendi, Mar 28 2017

CROSSREFS

Cf. A000069, A001969, A059010, A059011, A059012, A059013, A059014.

Cf. A023416.

Sequence in context: A047267 A058591 A247062 * A214642 A026179 A300063

Adjacent sequences:  A059006 A059007 A059008 * A059010 A059011 A059012

KEYWORD

nonn,base,easy,nice

AUTHOR

Patrick De Geest, Dec 15 2000

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 17 18:14 EST 2020. Contains 332005 sequences. (Running on oeis4.)