# Converting Base 16 digits to base 2 and 10 - Analysis Question

With base $$16$$, the digits are denoted as $$0, 1,\ldots, 9, A,\ldots, F$$. Let $$n = AB3$$. Rewrite $$n$$ with bases $$10$$, $$2$$.

I have no clue what this question means and how I should attempt to do this.

• If you understand radix notation (binary, hexadecimal, decimal) then the Question is rather straightforward. You are being given the hexadecimal presentation of a number, and asked re-present the same number as binary and decimal expressions. – hardmath Nov 21 '13 at 14:03

## 3 Answers

Hint: a number $n$ in base 10 can be written as follow: $$n=a_i \cdot 10^{i} + a_{i-1} \cdot 10^{i-1} \cdot \dots \cdot a_1 \cdot 10 + a_0 \cdot 10^0$$ where $a_i \in \{0, 1, \dots, 9\}$. Similar to this case...

• So what's i in this? – Kasun Jayasuriya Nov 21 '13 at 14:10
• It is the number of the digit, counting from the right and starting with $0$. In base $10$, the $i=2$ digit is the hundreds digit (because we started counting with zero), and the value is $10^2$ – Ross Millikan Nov 21 '13 at 14:17

In base 16, each number is composed of a series of the digits 0-9 and A-F, where, A represents 10, B 11, C 12 and so on up to the maximum for any digit which is F, representing 15.

As such, AB$3$ represents $10$ in the $16^2=256$s column, $11$ in the $16^1=16$s column and 3 in the units column, so in decimal (base 10) that's $10(256)+11(16)+3=2739$.

In general, for a natural number $n$, given a number in base $n$, the digit at the far right tells you how many units, the digit to the left of that how many $n$s, the next digit to the left how many $n^2$s etc. None of the digits in a number in base $n$ is allowed to exceed $n-1$.

For how to convert the number to base 2, see the algorithm presented in Adi Dani's answer.

$$n=(AB3)_{16}=A\cdot16^2+B\cdot 16^1+3\cdot 16^0=10\cdot256+11\cdot16+3\cdot1=2739$$ $$2739:2=1369+1$$ $$1369:2=2\cdot684+1$$ $$684:2=2\cdot342+0$$ $$342:2=2\cdot171+0$$ $$171:2=2\cdot85+1$$ $$85:2=2\cdot42+1$$ $$42:2=2\cdot21+0$$ $$21:2=2\cdot10+1$$ $$10:2=2\cdot5+0$$ $$5:2=2\cdot2+1$$ $$2=2\cdot1+0$$

$$2739=(101010110011)_2$$

• I gave you +1 without having checked your base 2 assertion, which is incorrect, but the algorithm is useful, so you deserve the +1. 110011001111 is not 2739 in base 2: it's 3279. $$110011001111=2048+1024+128+64+8+4+2+1=3279$$ The error is in the second line (and hence, as you know, all subsequent lines are inapplicable too), which should be $$1639=684⋅2+1$$ – George Tomlinson Nov 22 '13 at 20:43
• I edit my answer now is correct. I use $1639$ instead of $1369$ Thank you @bluesh34 – Adi Dani Nov 22 '13 at 22:34
• No problems. Oh, yeah: I meant 1369. – George Tomlinson Nov 25 '13 at 17:54