Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrad Stoltey
133 Pointsfor each decimal over to the right is one so 00001 is 1 and 00010 is two. so wouldn't 000111 be 1+2+3=6?
just a little confused
2 Answers
Matt Coale
Full Stack JavaScript Techdegree Graduate 17,884 PointsBrad Stoltey Good question! Binary can be a bit confusing to figure out, especially at first. Afterall, it's a language for the computers and humans are definitely NOT computers... To hopefully help you understand this a little better, let's look at how a binary counter iterates from 0 to 10:
We'll start with 8 bits (1 byte): 00000000
- 0 = 00000000
- 1 = 00000001
- 2 = 00000010
- 3 = 00000011
- 4 = 00000100
- 5 = 00000101
- 6 = 00000110
- 7 = 00000111
- 8 = 00001000
- 9 = 00001001
- 10 = 00001010
As I said, binary can be tricky. Basically, the further that first 1 gets shifted to the left, the larger the number. For example, if we continue on from 10...
- 11 = 00001011
- 12 = 00001100
- 13 = 00001101
- 14 = 00001110
- 15 = 00001111
- 16 = 0001000
If you need any additional help explaining this better, here is a resource I found that goes in depth on how binary works and it might be able to help answer any of those questions.
Also, for kicks and giggles, here is a project I made years ago that might help you visualize how this works.
Hope that helps!
Steven Parker
231,271 PointsYou are correct that 00001 is 1 and 00010 is two. But 00100 is 4, so 1 + 2 + 4 = 7.
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsModerator Note: Changed reply from a Comment to an Answer, so post may record as being answered. Matt Coale if you could place future answer in the Answer section of the post. It makes it easier for the Community users to know when a question has been answered. It also allows for your answer to be upvoted by others or marked as Best Answers by the poster. The comment section is used when you request or require additional information from the the OP before being able to give an answer.
Thanks for contributing and participating in the Community!! :)
Jason -Treehouse Community Moderator