Count numbers of 1 multiple of 3 till N

Revision en1, by prathams, 2015-07-18 22:28:59

How to count numbers whose binary representation has number of 1's multiple of 3 for all numbers between 1 to N.

For ex — N = 19 then ans = 5 Since, 7, 11, 13, 14, 19 have number of 1's multiple of 3.

Constraint : n < 1016

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English prathams 2015-07-18 22:28:59 283 Initial revision (published)