# Binary

While kids stayed at home due to haze during first half of the week, the school thoughtfully decided they’d give enough homework to keep them busy. Here’s one my younger daughter (Year 7) received on bases. She was given these digits to decipher:

```
10 1001 1110 1 10010 11001
```

She has just started on bases at school, and needed a clue. For a given assignment, she posted a couple of questions on school portal:

Kid | Hang on, I don’t really get it.. are we supposed to use a code or something? |
---|---|

Teacher | It is not meant to be easy! And think about the question – it is a code and you have to translate it! |

Kid | Is it a number or a word? |

Teacher | Shall I just tell you the answer? Remember, it is meant to be hard! |

At this point the puzzle had our full attention. Given that they are all 0s and 1s, we figured these correspond to base 2, which in turn are realized as decimals (or base 10) from a progression of 2^{x}.

## The notation system for different bases

Base 2 notation system uses only 0s and 1s; base 3 uses only 0s, 1s, and 2s; base 4 uses only 0s, 1s, 2s, and 3s; and so on. Similarly, base 10 would use all unit numbers from 0 to 9 — hence their respective base names.

## Solution

Once base was known, she began slotting in these numbers in a table by their order of units, tens, hundreds, and so on, as below.

```
16 8 4 2 1 BASE 10
1 0 = 2
1 0 0 1 = 8 + 1 = 9
1 1 1 0 = 8 + 4 + 2 = 14
1 = 1
1 0 0 1 0 = 16 + 2 = 18
1 1 0 0 1 = 16 + 8 + 1 = 25
```

## Base 2 to Base 10 using a tool

We could well have used a tool to translate from base 2 to base 10, but felt it was important to learn how to convert manually first. Calca understands `0b`

prefixed numbers as binary, and can be used thus — as a means to verify results:

```
0b10 in dec => 2
0b1001 in dec => 9
0b1110 in dec => 14
0b1 in dec => 1
0b10010 in dec => 18
0b11001 in dec => 25
```

## Deciphering the answer

Half way through these numbers, she exclaimed, “I know what this actually means. The 2nd of alphabets is `B`

, 9th is `I`

, 14th is…”

```
10 1001 1110 1 10010 11001 <- Base 2 values
2 9 14 1 18 25 <- Base 10 values
B I N A R Y <- Mapping alphabets
```

Hooray! Neat, yes?