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 trialKegan Windle
2,217 PointsWhy can't 00000100 = 3? Why does it have to be 00000011?
I'm having a hard time getting this. I know 00000001 = 1 and 00000010 = 2. What is 00000100?
2 Answers
okechukwu uneze
6,303 Pointsbecause 2^2 = 4
binary is base 2 and each space you move left it goes up one power.
0 0 1 1 1 = 2^2 + 2^1 + 2^0
0 0 4 2 1 = 4 + 2 + 1 = 7
Christopher De Lette
Courses Plus Student 7,139 PointsHi Kegan Windle
All internet "names" such as teamtreehouse.com are represented by an IPv4 or IPv6 address. In breaking down an address that is base 2, each octet is represented by 8 binary numbers, 0 or 1 (IPv6 is a bit more complex so I'll let you research if you're interested). Each 0 or 1 has a positional meaning that any device which understands routing can use to translate IP to name. To convert base 2 to base 10 the following math is required:
Each octet (dotted notation, so x.x.x.x for IPv4) contains a 0 or 1 and begins with the last binary number in the octet. So
X X X X X X X X X 192 128 64 32 16 8 4 2 1
Start from right to left and if there is a 1 in that position then it is considered 'on' and you would add that number to any other number containing a 1, anything with a 0 is considered 'off' and you do not add that number. Remember to only work with one octet at a time for simplicity sake. Here is one of the main websites I used throughout my career as a Network Administrator.
https://www.subnetting.net/Tutorial.aspx
Take care!
Christopher De Lette
Courses Plus Student 7,139 PointsIf this did not format correctly comment and I'll fix as I'm on my mobile ✌️
chris bradt
1,587 Pointschris bradt
1,587 Points4