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 trialalanstraiton
876 Pointsbinary numbers basic are?
i have been asked what the basic binary numbers are and couldn't not remember them
4 Answers
Dane Parchment
Treehouse Moderator 11,077 PointsOkay I'm going to copy an answer I gave to a very similar question a few years ago. It is very long and I recommend taking your time to read it, but when you're done you should be very comfortable with binary numbers after some practice. (Source: Computer Science Graduate Student :D)
This is going to be a long winded response so sit back, sip some tea and take this slow!
Normally when humans count we do so through the use of numbers represented like so: 19, 8, 345, 10. These numbers are what we call base 10 numbers. We call them base 10 because we formulate the values of these numbers by counting out how many 10s are in the value. We accomplish this by summing the values as they are multiplied by powers of 10, whose powers are represented by the values position. The position starts at 0, and is increases from right to left. Let's use 345
as an example of how to calculate a base 10 number.
We start off by figuring out the positions of each number:
- 5 is in the lowest position, position 0
- 4 is in the 2nd position, position 1
- 3 is in the highest position (in this given number), position 2
So now we calculate each position like I specified above, by multiplying the values by a power of 10 whose power is influenced by that values position!
Tip: When you see me say 10 to the power of something I will write it as so: 10 ^ something
this basically means that we are multiplying 10 by itself something amount of times. So for example. lets pretend I say 10 to the 3rd power, I am really saying: 10 ^ 3 = 10 x 10 x 10 = 1000
- 5 :
5 x 10 ^ 0 = 5 x 1 = 5
- 4:
4 x 10 ^ 1 = 4 x 10 = 40
- 3:
3 x 10 ^ 2 = 3 x 100 = 300
Now we add all the values up and we get 300 + 40 + 5 = 345
. That is how humans count. Now that you are familiar with that let's use the same concept to solve for your answer.
Computer do not count like humans they don't use base 10, instead they use base 2, because of this the only values a computer can use to represent a number is: 0 and 1 (which is 2 values when we start counting at 0). So when you see the binary number: 101101
you know that you need to find out what is value is by computing the 0s and 1s, like we did with base 10. The only difference here, is that we will be using 2 ^ something
since we are in base 2!
So let's find out the positions of that number starting from the right:
- 1 is in the lowest position, position 0
- 0 is in the 2nd position, position 1
- 1 is in the 3rd position, position 2
- 1 is in the 4th position, position 3
- 0 is in the 5th position, position 4
- 1 is in the highest position (at least for this number), position, 5
Now let's calculate them in the same order:
- 1:
1 x 2 ^ 0 = 1 * 1 = 1
- 0:
0 x 2 ^ 1 = 0 * 2 = 0
- 1:
1 x 2 ^ 2 = 1 * 4 = 4
- 1:
1 x 2 ^ 3 = 1 * 8 = 8
- 0:
0 x 2 ^ 4 = 0 * 16 = 0
- 1:
1 x 2 ^ 5 = 1 * 32 = 32
Now we add them up: 32 + 0 + 8 + 4 + 0 + 1 = 45
So the binary number 101101
is the binary representation of the number: 45
!
Using this same logic do you think you can solve: 111
?
If you can't the answer is equal to: 5 + 2
alanstraiton
876 Points0
Dane Parchment
Treehouse Moderator 11,077 PointsIncorrect, I explain why and give you the right answer in my response to your answer above. I recommend you re-read my answer and practice converting binary numbers on your own until you are comfortable with them.
You can use this site here to help.
alanstraiton
876 PointsHi Dane, thank you for your help. The langunes are new so receive a bit of time to get used to them.
alanstraiton
876 Points00000001 = 1 x 0 = 0 2x0 = 0 3x0 =0 4x0 = 0 5 x 0= 0 6 x 0 =0 7 x 0 = 0 answer 0
Dane Parchment
Treehouse Moderator 11,077 PointsThis is an incorrect answer. Re-read my answer.
The 1 is in the lowest position. Position 0.
Thus the formula for calculating is: 1 x (2 ^ 0)
which translates to 1 x (2 to the power of 0)
using your exponent rules you should be able to see that this is the equivalent of: 1 x 1 = 1.
Your answer should not be the accepted one. It's wrong.
Dane Parchment
Treehouse Moderator 11,077 PointsDane Parchment
Treehouse Moderator 11,077 PointsUsing this, you should be able to easily find out what:
00000001
is.