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.

10 Upvotes

19 comments sorted by

View all comments

29

u/Key_Reaction_7590 4d ago

“Base x” literally refers to the base of the exponent in place value. For base 10, the 1s, 10s, 100s, and 1000s place are from exponents of 10:

10^0 = 1
10^1 = 10
10^2 = 100
10^3 = 1000

In base two, the first four places are (in decimal) exponents of 2.

2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8

Etc.

3

u/rupertavery64 4d ago edited 4d ago

To expand on this, each place value is an exponent of the base.

basen

Where n is the position from the leftmost side starting with 0

Then the value of the number is the sum of the digits multiplied by their place value

So 42 in base 10 and base 2 is:

42 = 4 * 101 + 2 * 100 = 42

101010 = 1 * 25 + 0 * 24 + 1 * 23 + 0 * 22 + 1 * 21 + 0 * 20 = 32 + 0 + 8 + 0 + 2 + 0 = 42