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.

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.

1 Like

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

1 Like