cp's OEIS Frontend

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.

Showing 1-5 of 5 results.

A059009 Numbers having an odd number of zeros in their binary expansion.

Original entry on oeis.org

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
Offset: 0

Views

Author

Patrick De Geest, Dec 15 2000

Keywords

Comments

Positions of ones in A059448 for n >= 1. - John Keith, Mar 09 2022

Examples

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

Crossrefs

Programs

  • Haskell
    a059009 n = a059009_list !! (n-1)
    a059009_list = filter (odd . a023416) [1..]
    -- Reinhard Zumkeller, Jan 21 2014
    
  • 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 *)
  • PARI
    is(n)=hammingweight(bitneg(n,#binary(n)))%2 \\ Charles R Greathouse IV, Mar 26 2013
    
  • PARI
    a(n) = if(n==0,0, 2*n + (logint(n,2) - hammingweight(n) + 1) % 2); \\ Kevin Ryde, Mar 11 2021
    
  • Python
    i=j=0
    while j<=800:
        if bin(i)[2:].count("0")%2:
            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

Formula

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

A059010 Natural numbers having an even number of nonleading zeros in their binary expansion.

Original entry on oeis.org

1, 3, 4, 7, 9, 10, 12, 15, 16, 19, 21, 22, 25, 26, 28, 31, 33, 34, 36, 39, 40, 43, 45, 46, 48, 51, 53, 54, 57, 58, 60, 63, 64, 67, 69, 70, 73, 74, 76, 79, 81, 82, 84, 87, 88, 91, 93, 94, 97, 98, 100, 103, 104, 107, 109, 110, 112, 115, 117, 118, 121, 122, 124, 127, 129, 130
Offset: 0

Views

Author

Patrick De Geest, Dec 15 2000

Keywords

Comments

Positions of ones in A298952, and of zeros in A059448. - John Keith, Mar 09 2022

Crossrefs

Cf. A059009 (complement).
Cf. A023416 (number of 0-bits), A059448 (their parity), A298952 (opposite parity).
Cf. A001969 (even 1-bits), A059012 (even both 0's and 1's), A059014 (even 0's, odd 1's).

Programs

  • Haskell
    a059010 n = a059010_list !! (n-1)
    a059010_list = filter (even . a023416) [1..]
    -- Reinhard Zumkeller, Jan 21 2014
    
  • Mathematica
    Select[Range[130], EvenQ @ DigitCount[#, 2, 0] &] (* Jean-François Alcover, Apr 11 2011 *)
  • PARI
    is(n)=hammingweight(bitneg(n,#binary(n)))%2==0 \\ Charles R Greathouse IV, Mar 26 2013
    
  • PARI
    a(n) = if(n==0,1, 2*n + (logint(n,2) - hammingweight(n)) % 2); \\ Kevin Ryde, Mar 11 2021
    
  • Python
    #Program to generate the b-file
    i=1
    j=0
    while j<=250:
        if bin(i)[2:].count("0")%2==0:
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 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 == 1)
    a
    # Yosu Yurramendi, Mar 28 2017

Formula

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

Extensions

Name clarified by Antti Karttunen, Mar 28 2017

A059012 Numbers that have an even number of 0's and 1's in their binary expansion.

Original entry on oeis.org

3, 9, 10, 12, 15, 33, 34, 36, 39, 40, 43, 45, 46, 48, 51, 53, 54, 57, 58, 60, 63, 129, 130, 132, 135, 136, 139, 141, 142, 144, 147, 149, 150, 153, 154, 156, 159, 160, 163, 165, 166, 169, 170, 172, 175, 177, 178, 180, 183, 184, 187, 189, 190, 192, 195, 197, 198
Offset: 1

Views

Author

Patrick De Geest, Dec 15 2000

Keywords

Comments

Intersection of A001969 and A059010.

Examples

			36 is in the sequence because 36 = 100100_10. '100100' has two 1's and four 0's. - _Indranil Ghosh_, Feb 10 2017
		

Crossrefs

Programs

  • Mathematica
    Select[Range[200],AllTrue[{DigitCount[#,2,0],DigitCount[#,2,1]},EvenQ]&] (* Harvey P. Dale, Aug 16 2021 *)
  • PARI
    is(n)=hammingweight(n)%2==0 && hammingweight(bitneg(n, #binary(n)))%2==0 \\ Charles R Greathouse IV, Mar 26 2013
    
  • Python
    i=0
    j=1
    while j<=300:
        if bin(i)[2:].count("1")%2 == 0 == bin(i)[2:].count("0")%2:
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 10 2017

A059011 Odd number of 0's and 1's in binary expansion.

Original entry on oeis.org

2, 8, 11, 13, 14, 32, 35, 37, 38, 41, 42, 44, 47, 49, 50, 52, 55, 56, 59, 61, 62, 128, 131, 133, 134, 137, 138, 140, 143, 145, 146, 148, 151, 152, 155, 157, 158, 161, 162, 164, 167, 168, 171, 173, 174, 176, 179, 181, 182, 185, 186, 188, 191, 193, 194, 196, 199
Offset: 1

Views

Author

Patrick De Geest, Dec 15 2000

Keywords

Crossrefs

Programs

  • Haskell
    a059011 n = a059011_list !! (n-1)
    a059011_list = filter (odd . a071295) [0..]
    -- Reinhard Zumkeller, Aug 09 2014
  • Mathematica
    Select[Range[200],EvenQ[IntegerLength[#,2]]&&OddQ[DigitCount[#,2,1]]&] (* Harvey P. Dale, Oct 16 2012 *)
  • PARI
    is(n)=hammingweight(n)%2 && hammingweight(bitneg(n, #binary(n)))%2 \\ Charles R Greathouse IV, Mar 26 2013
    

Formula

A071295(a(n)) is odd. - Reinhard Zumkeller, Aug 09 2014

A059013 Odd number of 0's and even number of 1's in binary expansion.

Original entry on oeis.org

0, 5, 6, 17, 18, 20, 23, 24, 27, 29, 30, 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, 257, 258, 260, 263, 264, 267, 269, 270, 272, 275, 277, 278, 281, 282, 284, 287
Offset: 1

Views

Author

Patrick De Geest, Dec 15 2000

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[0,300], EvenQ[DigitCount[#,2,1]] && OddQ[DigitCount[#,2,0]]&] (* Harvey P. Dale, Jun 13 2013 *)
  • PARI
    is(n)=hammingweight(n)%2==0 && hammingweight(bitneg(n, #binary(n)))%2 \\ Charles R Greathouse IV, Mar 26 2013
Showing 1-5 of 5 results.