# Number Systems
| System | Base | Digits |
| ------------ | ------- | :-------------------------------: |
| Decimal | Base 10 | $0,1,2,3,4,5,6,7,8,9$ |
| [[Binary]] | Base 2 | $0,1$ |
| Octal | Base 8 | $0,1,2,3,4,5,6,7$ |
| Hexa-decimal | Base 16 | $0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$ |
## Base Expansions
> [!info] **Base $b$ Definition**
> **Theorem:** Let $b$ be a positive integer greater than $1$. Then if $n$ is a positive integer, it can be expressed uniquely in the form:
> $n=a_k b^k + a_{k-1} b^{k-1}+...+a_1 b^1 + a_0$
> where $k$ is a nonnegative integer and $a_0,a_1,…,a_k$ are nonnegative integers less than $b$.
This representation of $n$ is called the *“base $b$ expansion of $n$”* and can be denoted as: $(a_ka_{k-1}...a_1a_0)_b$
- The subscript 10 is usually omitted for base 10 expansions, but these *decimal numbers still use this system of expansion*
## Base Conversion
> [!summary] **Base Conversion**
> To construct the base $b$ expansion of an integer $n$:
> 1. Divide $n$ by $b$ to obtain a quotient ($q$) and remainder ($r$).
> - $n=bq_0 + a_0$, where $0 \le a_0 < b$
> - The remainder, $a_0$, is the rightmost digit in the base $b$ expansion of $n$
> 2. Next, divide $q_0$ by $b$:
> - $q_0 = bq_1 + a_1$, where $0 \le a_1 < b$
> - The remainder, $a_1$, is the second digit from the right in the base $b$ expansion of $n$.
> 3. Continue by successively dividing the quotients by $b$, obtaining the additional base $b$ digits as the remainder.
> - The process terminates when the quotient is 0.
>