Skip to main content

Why you should memorize binary and the 2^n sequence.

If you're reading this, you probably have crossed with my Tinycard deck where I provide nice flashcards to help you memorize the binary code from 0 to 15 and the 2 ^ n sequence from n = 0 to n = 12 (I mean, how else would you, I don't advertise this blog in any way).

Anyway, I'll start this by asking you what 8 * 7 is. What is 8 * 7? You're probably thinking 8 * 1 is 8, and that you have to increment 8  seven times until you think of the number 56. But that's quite a long process, and definitely very favorable to mistakes. So what if you could instantly say "56", without even thinking about it? Wouldn't it be satisfying to instantly "2 ^ 11 is 2048" when asked / need to know? I bet it would, and, what's more, when resolving related problems, your mind won't even think about this, and it can be occupied with something more relevant like trying to solve the actual task at hand. The same goes for instantly saying "13 in binary is 1101". You don't need to make all the way up from "0 is 0000", you don't even need to think about it, it'll just happen.
It's not even hard to be honest, I memorized it all in 3 days, using up only 1 minute each day.

You may have also crossed this to know how exactly it is you convert a number to binary. There really could be no simpler task. Do you know how to divide numbers by 2? Great! That's all the knowledge you need. Here is an example where I convert the number 159 to binary:

159 / 2 = 79 (+1)
79 / 2 = 39 (+1)
39 / 2 = 19 (+1)
19 /2 = 9 (+1)
9 / 2 = 4 (+1)
4 / 2 = 2 (+0)
2 / 2 = 1 (+0)
1 / 2 = 0 (+1)

Basically, you just divide every number by two and note both the result and the leftover from the division. In the first example, the leftover is 1, as 79 * 2 = 158, and you have to do 158 + 1 in order to get 159. Following this line of thought, the leftover from the division 4 / 2 is 0. You'll then want to rearrange the leftovers in the opposite direction of which you noted them. In this example, I noted them "11111001", so 159 in binary is 10011111.
Let's do the same for the number 591:

591 / 2 = 295 (+1)
295 / 2 = 147 (+1)
147 / 2 = 73 (+1)
73 / 2 = 36 (+1)
36 / 2 = 18 (+0)
18 / 2 = 9 (+0)
9 / 2 = 4 (+1)
4 / 2 = 2 (+0)
2 / 2 = 1 (+0)
1 / 0 = 0 (+1)

So 591 in binary is 1001001111. Note that the last division you make is always "1 / 0 = 0", and has a leftover of 1. A binary number clearly begins with a 1, as adding a 0 doesn't have much meaning ("010" has the same value as "10", just like in the decimal base).
It is for doing the exact opposite that one would need to memorize the 2 ^ n sequence, at least until n = 12.
If you want to convert "10011111" back to 159, you first write down the number in binary, noting the positions of the 1s (starting from zero and the end of the number):

1 (7)
0
0
1 (4)
1 (3)
1 (2)
1 (1)
1 (0)

Now you sum up every 2 ^ n result, where n is a position of a one. Like this:

2 ^ 7 = 128
2 ^ 4 = 16
2 ^ 3 = 8
2 ^ 2 = 4
2 ^ 1 = 2
2 ^ 0 = 1
128 + 16 + 8 + 4 + 2 + 1 = 159

It's pretty simple, actually, and should show why knowing the 2 ^ n sequence is worth memorizing.
Now let's do the same for 591 (or should I say "1001001111"?).

1 (9)
0
0
1 (6)
0
0
1 (3)
1 (2)
1 (1)
1 (0)

2 ^ 9 = 512
2 ^ 6 = 64
2 ^ 3 = 8
2 ^ 2 = 4
2 ^ 1 = 2
2 ^ 0 = 1

512 + 64 + 8 + 4 + 2 + 1 = 591

Again, pretty simple.

So that's that. Now you know why you should memorize the sequence 2 ^ n and the binary sequence. A little bonus tip for learning to count in binary: much like you do with base 10, where when you have 99 the next number is two 0s followed by a 1 (100), when you have 111 in binary, the next number will be three 0s followed by a 1 (1000). Easy!

Comments

Popular posts from this blog

Making it clear

Just to make things clear - at the moment, I'm not interested in writing in this blog for various reasons. However, I was recommended to have a blog with my name on it anyway for even more reasons. Hence, I did it, and now you're reading this for some reason.