Math - Number Bases - Challenge

In this lecture we looked at how to convert numbers between decimal (base 10), binary (base 2) and hexadecimal (base 16).

Your challenge is to take the number 173 (or any integer of your choice) and;

  1. Find the binary representation of the number
  2. Find the hexadecimal representation

Pop your answer below and remember to use the spoiler tags.

2 Likes

1111011
7B

You picked 123, correct :slight_smile:

Ooops - i did - cause i cannot write on paper with ink anymore !
And then didn’t check back here…
Not helped by a very late night/early morning Sat/Sun and the Superbowl on Sun/Mon morning…
173 is

10101101
AD

1 Like

That’s cool. I did say that you could pick any number you liked.
Hopefully doing both gave you some good practice. :slight_smile:

I took 2077 (you probably know why).

2077 / 16 = 129 + 13 (D)
129 / 16 = 8 + 1
remainder 8

So 2077 is 81D in hex.

I spare everyone the same method in binary (the same dividing by 2).
2077 in binary is 100000011101.

That’s so much fun I’m translating back results to verify. Picking a random RGB color and translating that to decimal, and then find it’s place in % relative to the entire RGB scale.
Then annoying my gf explaining how awesome it is.
I’m having a blast.

Nice work, and I can’t wait for Cyberpunk!

It’s great to hear that you’re having fun with the course. It’s that extra experimentation and practice that will really help cement the concepts in your mind.
And your conversations with your girlfriend sound much like the conversations I have with my wife! :smiley:

Decimal: 42
binary: 101010
Hexadecimal: 2A

1 Like

I’m not sure what I’m doing wrong, but when I tally up my binary representation of 173, it keeps equaling 181.

When I keep dividing 173 by 2, I get:

86 43 21 10 5 2 1 0

When I consider the remainders, I get:

1 0 1 1 0 1 0 1

And when I multiply those by their respective placements (128, 64, 32, 16, 8, 4, 2, and 1) and then add the results, I keep getting 181. Any idea where my mistake is?

Hi @karaokelove. You’re almost there, you’re just making a small mistake on the last step. Once you’ve got all your remainders you need to read them off backwards.

So instead of 10110101 = 181, reverse it to get 10101101 = 173.

Hope that clears things up for you.

2 Likes

Decimal: 278
Bin: 100010110
Hex: 116
:slight_smile:

1 Like

I went with 173 and got:

10101101

and

0AD

1 Like

Nice work. You can drop the leading 0 for the hex representation and just have AD.

1 Like

Showing my work here:
As a side note I learned OneNote will do simple calculations automatically. I still had to write out my own remainders, but I didn’t have to actually do the division portion (it gave a decimal result).
173 binary:

173/2 = 86 r 1
86/2 = 43 r 0
43/2=21 r1
21/2 = 10 r1
10/2=5 r0
5/2=2 r1
2/2 = 1 r0
1/2 = 0 r1

173=10101101

173 hex:

173/16=10 r 13
10/16 = 0 r 10

173 = AD

And my own number:1456
1456 binary:

1456/2=728 r0
728/2=364 r0
364/2=182 r0
182/2=91 r0
91/2=45 r1
45/2=22 r1
22/2=11 r0
11/2=5 r1
5/2=2 r1
2/2=1 r0
1/2=0 r1

1456 = 10110110000

1456 hex:

1456/16=91 r0
91/16=5 r11
5/16=0 r5

1456 = 5B0

1 Like

For the number 173 I got a Binary Value of 10101101. For the Hex value I got AD.

1 Like

For the number 173:
Binary base: 10101101
Hex base: AD

And I picked the numer 373:
Binary base 101110101
Hex base: 175

1 Like

For the number 173 in binary I got 10101101 and for hex I got AD

1 Like

I went ahead and used the example 173 decimal number. I had used Google Sheets to set up a spreadsheet much like the blackboard in the video and used the MOD function to calculate the remainders.

Binary: 10101101
Hexadecimal: AD

1 Like

Great work. I love a good spreadsheet!

Ok I understand how to convert the number into binary but how do you convert it back? for 91 it was equal to 1011011 and then you said to do 1+2+8+16+64 where exactly do these numbers come from? is it multiplying the last by 2? and then just skipping the zeros? Thank you!

Privacy & Terms