The straightforward way is simply to write the number out in binary and count the one-bits. It works for any number.
In this specific case, since the multiplications are by powers of 2, resulting in shifts, and the resulting binary numbers don't overlap, the number of bits is bitcount(3*4096) + bitcount(15*256) + bitcount(3*16) + bitcount(3) = bitcount(3) + bitcount(15) + bitcount(3) + bitcount(3) = 2 + 4 + 2 + 2 = 10. Dave On Aug 3, 2:04 pm, amit <amitjaspal...@gmail.com> wrote: > (3*4096+15*256+3*16+3). How many 1's are there in the binary > representation of the result. > > Is there a quick way to count the number of set bits in this number > manually??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.