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 trial

Digital Literacy Computer Basics Computer Basics Binary

what is 00000111?

we thought it was 6. But we got it wrong and we need some help. We don't really understand.

5 Answers

Tri Pham
Tri Pham
18,671 Points

No its 7. Since it is base 2, all the digits goes from 0 to 1. You can more formally calculate it by finding the powers of 2 and multiplying it by the digit there and adding them all up.

First 3 powers of 2:

2^0 = 1

2^1 = 2

2^2 = 4

so 101 would be 1 x (2^2) + 0 x (2^1) x 1 x (2^0) = 1 x (4) + 0 x (2) + 1 x (1) = 4 + 0 + 1 = 5

and 111 would be 1 x (2^2) + 1 x (2^1) x 1 x (2^0) = 1 x (4) + 1 x (2) + 1 x (1) = 4 + 2 + 1 = 7

But you could have just counted it :).

000 = 0

001 = 1

010 = 2

011 = 3

100 = 4

101 = 5

110 = 6

111 = 7

thank you very much for all of the responses. It helped a lot.

Sandra Norris
Sandra Norris
3,895 Points

One 1 + One 2 + One 4 = 7 simplified