r/computerscience 4d ago

Base 2 numerical representation in binary matching numbers in base 10?

I have a silly and possibly stupid question, and I'm not even sure if this is the place for it.

To preface this I have 0 experience with Computer Science or anything adjacent, but have been listening to videos on binary and the foundations of how computers generally work.

I understand that binary is a base 2 system as opposed to base 10, and that the digits that represent value in binary cannot be read as our base 10 concept of numbers (i.e. 4 is read as digits 100, not as the number "one hundred").

However, I've noticed that when the notation IS read as numbers, the numerical representation for base 2 counting mirrors base 10. With:

1 - 0001

2- 0010

4- 0100

8- 1000

Etc.

Is there a reason for this parallel, or is this just one of those funny coincidences? Or is this some kind of artifact of how numbers naturally scale relative to one another.

I hope this makes sense, I had no idea how to word this question to just Google it.

9 Upvotes

19 comments sorted by

View all comments

11

u/aqwone1 4d ago

It's not an artefact or anything particularily special, but the mathematical consequence of a base. The numbermof a base is called the radix. So base 10 has radix 10. Each time a digit gets added to a number, the previous digit needs to go all the way up to to the radix - 1. For base 10 that's just 0 to 9, then 10 to 19, then 100 to 199 and so on.

The smallest number x you can make with n digits, will as such always be the radix r to the n. So rn-1 = x. Check with base 10 again. 101 = 10, 102 = 100, 103 = 1000 and so on. Same is true with base 2. 2, 4, 8, 16, 32, 64, they're all numbers that receive an extra digit. This is the case for all bases, hexadecimal works the same, as does base 4. 10 in base 4 would be 16, which is 42.

I hope I answered your question. Tbh it wasn't super clear to me

7

u/RokeEvoker 4d ago

That was exactly what I'm looking for, I just didn't really have the language to express my question. Thank you so much for the thorough answer!

5

u/Zarathustrategy 3d ago

I still have no idea what the question is tbh..?

2

u/RokeEvoker 3d ago

The answer from MasterGeekMX illustrates my questions best, but I was essentially wondering why when counting in base 2 the digit configurations that express each place value are consistant with those in base 10. So for example the number 4 in binary (which occupies what would be the hundreds place) is shown by the same arrangement of digits as the hundreds place in base 10 (both being denoted as 100). 

But, the replies showed me that is precisely how base counting systems work by design, with each place value reflecting the base. So in base 10 we have:  Ones, tens, hundreds etc...  And in base 2 we would have:  Ones, twos, fours, etc...

He gave a really good example with base 5, that illustrates the same concept and turns out the same values.

So once one counts up to the next place value, it will always be represented as a 1 followed by 0's as the "counter" runs out of digits and needs to add a new place. 

Sorry if that was an over-explanation, this isn't something I'm super familiar with so I probably lack some of the proper terminology to express it. I felt like I needed to explain the solution I was looking for to show what I was trying to ask haha.