All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Counting ones (Posted on 2018-06-18) Difficulty: 2 of 5
How many ones are used in writing all of the numbers from 0 to 2018 (inclusive) in binary form?

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Hints/Tips Too hot to finish (hint) | Comment 1 of 2
Well, 2048 = 2^11

So, there are 2048 numbers from 0 to 2047, and half of them have a 1 in each of eleven places, for a total of 1024 * 11 = 11,264 ones.

So all I need to do is subtract the 1's in 2019 through 2047 inclusive.  That should be easy, but it is too hot right now.



(Fixed to reflect correct number of digits as 11)

Edited on June 18, 2018, 3:49 pm
  Posted by Steve Herman on 2018-06-18 11:08:57

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information