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 trialGraham Laseter
85 PointsWhat number does 00000001 represent?
.
3 Answers
Alexander Davison
65,469 PointsThe answer is 1.
This is because 2 to the 0th power equals 1.
// 00000001 represents...
0^7 + 0^6 + 0^5 + 0^4 + 0^3 + 0^2 + 0^1 + 2^1 // This equals 1 because any number to the zeroth power equals 1.
As you see, if the bit is 0, you use 0 as the base (0 to any power is always 0) and the position of the bit at the exponent. If the bit is 1, you use 2 as the base. You take all the results of the powers and add them up and you get the result.
Another example:
// 0011 respsents...
0^3 + 0^2 + 2^1 + 2^0 // This equals 3 because 2^1 is 2 and 2^0 is 1 and the sum of them is 3.
I hope this helps. ~Alex
Eric Griswold
Courses Plus Student 5,303 Points1
Peter Gess
16,553 PointsIt is 1