# Number Base

A

number base(or base for short) of a numeral system tells us about the unique or different symbols and notations it uses to represent a value.For example, the number base 2 tells us that there are only two unique notations 0 and 1.

The most common number base is decimal, also known as base 10. The decimal number system uses 10 different notations which are the digits 0~9.

Bases are not necessarily positive integers. Bases can be negative, positive, 0, complex and non-integral, too, although these are rarer.

Other frequently used bases include base 2 and base 16. These are used in computing, and are called binary and hexadecimal, respectively.

#### Contents

## Integer Number Bases

## Number Base - Converting to Different Bases

As most commonly used number base system is decimal, we shall divide conversions into three parts:

- from any base to decimal number base
- from decimal to any number base
- from any base to any other base.

For now, we will learn about Integer number conversions and floating decimal conversions.

## Conversion to Decimal System

Suppose we have a positive integer \(\overline{c_nc_{n-1}\cdots c_3c_2c_1c_0.c_{-1}c_{-2}\cdots c_{-m}}\) in base \(b\) and we want to convert it to base 10 with \(n\) digits before the decimal point and \(m\) digits after the decimal point.

Then it can be represented in decimal base as

\[\displaystyle \sum^n_{r=-m}(c_i\times b^r).\]

Convert \(10_2\) to base 10.

Applying the above formula, we have

\[ (1 \times 2^1) + (0 \times 2^0) =2. \ _\square\]

Convert \(1.4_{8}\) to decimal base.

Applying the above formula, we have

\[(1 \times 8^0) + (4\times 8^{-1})=1.5. \ _\square\]

## From Decimal to Other Bases

**For integer numbers:**

For conversion from decimal to other bases we follow the following steps:

- Divide the decimal number to be converted by the new base and note the remainder.
- Divide the quotient obtained in previous division by new base and note the remainder.
- Repeat step 2 until the quotient is 0.
- Now, after quotient becomes 0, write the remainders obtained from right to left in the order they were obtained; if you get 1 as remainder from the first division, 3 from second division, and 6 from the third division, then write it as 631.

Convert \(27_{10}\) to base 8.

Using the steps studied above, we have the following:

- dividing 27 by 8, we get remainder 3 and quotient 3,
- dividing 3 by 8, we get remainder 3 and quotient 0.
Hence, its equivalent octal representation is \(33_8\). \(_\square\)

**For floating decimal numbers:**

Suppose we have a positive integer \(\overline{c_nc_{n-1}\cdots c_3c_2c_1c_0.c_{-1}c_{-2}\cdots c_{-m}}\) in decimal base with \(n\) digits before the decimal point and \(m\) digits after. Then the integer part and fractional part can be separately converted and then added.

The integer part can be converted as in the above example, so we have to convert the fractional part now. That is, \(0.c_{-1}c_{-2}\cdots c_{-m}\) in decimal base is to be converted to base \(b\). It can be done by following the steps below:

- Multiply the base ten fractional part by \(b\).
- Note the integer part of the resulting number.
- Now again take the fractional part of the previous resulting number as new fractional part. If it is zero, then we are done. If not, then we will repeat the above steps.
- All the integer parts noted are written from left to right in the order they were obtained, preceded by a decimal point.

It can be clearly understood by an example:

Convert \(987.11111111111\cdots \) to octal number base.

Firstly, the integer part \(987\) will be equal to \(1733\) in octal base by the above theory.

Now, we will take fractional part \(0.111111111111\cdots\).

Multiplying by 8 we get \(0.888888888888888888\cdots\).

Now, the integer part is zero and the new fractional part is \(0.888888888888\cdots\).

Again multiplying this new fractional part by 8, we get \(7.1111111111111\cdots\).

Now, the integer part is 7 and the new fractional part is \(0.111111111\cdots\).

Here we see that we again have \(0.111111111\cdots\), so the digits will repeat.

Hence, the octal representation of \(0.11111111111\cdots\) is \(0.070707070707\cdots\).

Therefore, the new number will be \(1733.07070707\cdots\) in octal base. \(_\square\)

## From One Base to Another

This can be done easily by first converting the initial number in decimal base and then to required base.

Convert \(10_2\) to base 8.

We can easily convert it into decimal which is 2.

Then we can convert this into octal which is also 2.

Hence, \(10_2=2_8\). \(_\square\)Note: This example gives us one more idea that if the initial value is less than the base into which it has to be converted, then the number remains the same. For example, \(7_8=7_{10}=7_{16}=7_{100} \), etc.

## Number Base - Problem Solving

This section of the wiki shows examples of solving problems that use number base.

What is the largest positive integer less than \(10^6\) such that when written in base 2, the binary representation only consists of all 1's?

Note that \(2^{10} = 1024 \approx 10^3 \) and \(2^{20} = \left(2^{10}\right)^2 > \left(10^3\right)^2 \) and \(2^{19} \) is the largest power of 2 less than \(10^6\).

For its binary representation to only consist of all 1's, the number must of the form \(2^{19}-1 = \underbrace{1111111\ldots1}_{\text{nineteen 1's}}\) in base 2.

Therefore, the answer is \(2^{19}-1. \ _\square\)

\[\large (102030405060504030201)_7\]

What integer \(0 \leq n \leq 7\) would need to be subtracted from the above number for it to be divisible by \((8)_{10}\)?

\[\]
**Clarification:**

- No calculators please!
- The subscript 7 indicates that we are working in base 7.

##### Try more questions on Bases.

In base 10, you can determine the divisibility by 3 or 9 simply by adding up all the digits in the number; if the results are divisible by 3 or 9, then the numbers are divisible by 3 or 9, respectively.

What is the smallest base \(n\) such that we can do the same trick for all the numbers from 2 to 6?

In other words, what is the smallest integer \(n > 1\) such that for any number \(x\) written in base \(n\) we can determine the divisibility by all integers \(m\) (\(2 \leq m \leq 6\)), by adding up all the digits of \(x\) and, if the result divides by \(m\), concluding that \(x\) is divisible by \(m\)?