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!)
A303065 Number of numbers < n whose binary representation has the same difference between the numbers of 0's and 1's as n does. 0
0, 0, 0, 0, 1, 1, 2, 0, 0, 1, 2, 1, 3, 2, 3, 0, 0, 2, 3, 3, 4, 4, 5, 1, 5, 6, 7, 2, 8, 3, 4, 0, 0, 1, 2, 4, 3, 5, 6, 4, 4, 7, 8, 5, 9, 6, 7, 1, 5, 10, 11, 8, 12, 9, 10, 2, 13, 11, 12, 3, 13, 4, 5, 0, 0, 1, 2, 6, 3, 7, 8, 9, 4, 9, 10, 10, 11, 11, 12, 5, 5, 12, 13 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,7

COMMENTS

First occurrence of k, k=0,1,2,...: 0, 4, 6, 12, 20, 22, 25, 26, 28, 44, 49, ..., . - Robert G. Wilson v, Feb 08 2018

LINKS

Table of n, a(n) for n=1..83.

FORMULA

a(n) = 0 iff n belongs to A097110. - Rémy Sigrist, May 16 2018

EXAMPLE

There are two numbers below 6 with number of 1's in the binary representation minus number of 0's equal to 1, namely 1 and 5, therefore a(6)=2.

There are 3 numbers below 12 with number of 1's in the binary representation minus number of 0's equal to 0, namely 2, 9, 10, therefore a(12)=3.

MATHEMATICA

d[n_] := DigitCount[n, 2, 1] - DigitCount[n, 2, 0]; f[n_] := Block[{fd = d[n], c = k = 0}, While[k < n, If[d@ k == fd, c++]; k++]; c]; Array[f, 83, 0] (* Robert G. Wilson v, Feb 08 2018 *)

PROG

(Python)

d=[0]*200

for n in range(1024):

    b = bin(n)[2:]

    c0 = b.count('0')

    c1 = len(b) - c0

    diff = c0 - c1

    print str(d[100+diff])+', ',

    d[100+diff] += 1

CROSSREFS

Cf. A037861, A097110.

Sequence in context: A079113 A144874 A333365 * A325406 A257900 A039971

Adjacent sequences:  A303062 A303063 A303064 * A303066 A303067 A303068

KEYWORD

nonn,base

AUTHOR

Alex Ratushnyak, Apr 17 2018

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 July 29 14:59 EDT 2021. Contains 346346 sequences. (Running on oeis4.)