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 in base and we want to convert it to base 10 with digits before the decimal point and digits after the decimal point.
Then it can be represented in decimal base as
Convert to base 10.
Applying the above formula, we have
Convert to decimal base.
Applying the above formula, we have
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 the previous division by the 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 the remainder from the first division, 3 from the second division, and 6 from the third division, then write it as 631.
Convert 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 .
For floating decimal numbers:
Suppose we have a positive integer in decimal base with digits before the decimal point and 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, in decimal base is to be converted to base . It can be done by following the steps below:
- Multiply the base-ten fractional part by .
- 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 to octal number base.
Firstly, the integer part will be equal to in octal base by the above theory.
Now, we will take fractional part .
- Multiplying by 8 we get .
- Now, the integer part is zero and the new fractional part is .
- Again multiplying this new fractional part by 8, we get .
- Now, the integer part is 7 and the new fractional part is .
- Here we see that we again have , so the digits will repeat.
Hence, the octal representation of is .
Therefore, the new number will be in octal base.
From One Base to Another
This can be done easily by first converting the initial number in decimal base and then to the required base.
Convert 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, .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, , etc.
If , find the digit sum of .
Note that is the number in base .
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 such that when written in base 2, the binary representation only consists of all 1's?
Note that and and is the largest power of 2 less than .
For its binary representation to only consist of all 1's, the number must of the form in base 2.
Therefore, the answer is
How many integers with can be written as a sum of numbers of the form , where each power of 5 may be used at most three times?
Let be a polynomial with nonnegative integer coefficients. If and , what is
Is the above number divisible by (No calculators should be necessary!)
Clarification: The subscript 12 indicates we are working in base 12.
Try more questions on bases.
What integer would need to be subtracted from the above number for it to be divisible by ?
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 such that we can do the same trick for all the numbers from 2 to 6?
In other words, what is the smallest integer such that for any number written in base we can determine the divisibility by all integers by adding up all the digits of and, if the result divides by , concluding that is divisible by