Number Bases

An introduction to number bases, using other numbers apart from 10 for the base in which to write numbers.
Bases need not be whole numbers themselves; we look at negative bases; negative "digits", using the Fibonacci numbers as the base and also factorials.
The calculators on this page require JavaScript but you appear to have switched JavaScript off (it is disabled). Please go to the Preferences for this browser and enable it if you want to use the calculators, section links and other interactive features, then Reload this page.
Contents of this page
The Things To Do icon means there is a You Do the Maths... section of questions to start your own investigations. The calculator calculator icon indicates that there is a live interactive calculator in that section.

Representing whole numbers in different bases

We normally write numbers in base 10 so that each digit counts a power of 10 in the value:
2017 = 2×102 + 0×102 + 1×101 + 7×100
In the American and UK systems of measuring liquids in pints and gallons, there are 8 pints to 1 gallon, so 20 pints represents 2 gallons and 4 pints.
It used to be the case that 8 gallons make 1 bushel in the UK but the American and British systems are now different. This is a base 8 system where we counts in 8s:
90 pints is 1×82 + 3×8 + 2:
90 in base 10 is 132 in base 8

Digits

We see that in base 10 (the decimal system), we need only 10 symbols, the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
In Base 8 (octal) we need only the 8 symbols 0, 1, 2, 3, 4, 5, 6, 7 because 8 in one column will convert into 1 in the next higher column.
Similarly in base β we need only β symbols for the digits, one digit per column.
So what if the base is bigger than 10?
Computer engineers often use this since computers work in Base 2 (Binary) using binary-digits 0, 1 and it was often more convenient to use base 16 (hexadecimal) using the "digits" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
In base β we need only β 'digit' symbols
To show what base a number is in, we write its base as a suffix after the number representation, e.g.:
90 = 1328
10 = 128
7 = 125
If we omit the base then the base used is 10.

Names of Bases

base 2: binary
base 3: ternary, trinary
base 4: quaternary
base 5: quintal, quinary
base 6: sextal, senary
base 7: septal, septenary
base 8: octal
base 9: nonary
base 10: decimal, denary
base 11: undecimal
base 12: duodecimal
base 16: hexadecimal
base 20: vigesimal
base 30: trigesimal
base 40: quadragesimal
base 50: quinquagesimal
base 60: sexagesimal
base 70: septuagesimal, septagesimal
base 80: octagesimal
base 90: nonagesimal, nonogesimal
base 100: centesimal
The vigesimal system was used by the Mayan civilisation in central America and also in Britain where 20 is called a "score". Other culture used a base 5 system (New Hebrides) or a binary system. 12 was also popular because it is easy to divide by 2, 3 and 4. The system of money used in Britain from the 8th century until 1971 had 12 pence (d) in a shilling (s) and 20 shillings in a pound (£).

An easy method to convert a number to and from base β

Let's look at an example.
To convert a (decimal) number to base 6, say, keep dividing the number by 6 recording any remainders. The remainders become the base 6 representation of the number.
5755
959rem = 1 5755 = 6×959 + 1
159rem = 5959 = 6×159 + 5
26rem = 3159 = 6×26 + 3
4rem = 226 = 6×4 + 2
0rem = 44 = 6×0 + 4

To see the base 6 representation, write down the reminders from the bottom to the top:
5755 = 423516
This works for any numeric base and shows that the 'digits' of base β must be 0,1,2,...,β-1 because they are the remainders on dividing by β.
To convert a number from base β to decimal we reverse the process, starting with the leftmost digit and continually multiplying by 6 and adding in the next digit as shown in the multiplications in the table above, working from the bottom row to the top.

Negative numbers

We usually represent negative numbers with a negative sign (–) before the value so that we have, in increasing order, the numbers
... -3 -2 -1 0 1 2 3 ...
However, we can represent both positive and negative values without using a sign if we have a negative base

Negative Bases

If we use base -10 (negadecimal) then the columns have the values
Column:...43210
Meaning...(-10)4(-10)3(-10)2(-10)1(-10)0
Value...10000–1000100–101
At first it may not be obvious that
Every whole number value, both positive and negative, has a unique representation in base -10 (negadecimal) using just the digits 0 to 9 without needing a sign
For instance, What about 1000? Try these practice problems:

You Do The Maths...

Check your answers with the Calculator in the next section
  1. Write these numbers in base −10:
    110, 119, 150, 199, 301, 399, 901, 999
  2. How are these (base 10) values represented in base −10:
    −1 −2 −9 −10 −11 −100 −1000
  3. What are the first 5 column headers in base −2?
    Make a table of numbers from −12 to 12 in base −2.

Negative digits

Instead of using powers of a negative number base to represent negative values, we could use negative 'digits'.
This is not as peculiar as it might at first sound. For example if the time is 2:50 then we can say "10 to 3" which is in effect using the hour 3 and the minutes -10.
We can also see times expressed with minutes from 0 to 59 (base 60) on timetables for example and, when saying the time the minutes go from -29 to +30 as in "29 minutes to 3" up to "3:30".
So for base β instead of using 'digits' 0 to β−1 we could just as effectively use 'digits' −β/2 to +β/2 if β is odd (rounding the halves). To make sure representations are unique when β is even we can decide to use either −β/2 or else β/2 but not both 'digits'.
Using two symbols for negative digits is inconvenient so to use one single 'digit' per column and we can show negative 'digits' with the negative sign placed above the 'digit' so that −3 is written as 3.
Base −10 using 'digits' 4−10, 3−10, 2−10, 1−10, 0−10, 1−10, 2−10, 3−10, 4−10, 5−10
0 .. 5: 0−10 .. 5−10
6 .. 15: 14−10 .. 15−10
16 .. 25: 24−20 .. 25−20
 
−4 .. −1: 4−10 .. 1−10
−16 .. −5: 24−10 .. 15−10
−26 .. −15: 34−10 .. 25−10
123 is 100 −20 −3 = 77
It is easy to see if a value represented using nega-digits is positive or negative. Show how
If the leftmost 'digit' is positive, the value is positive;
if the leftmost 'digit' is negative, the value is negative
Also, it is easy to negate a value in this system. Show how
Change each positive 'digit' into its negative form and vice-versa.

Other bases

Instead of using powers of a number as the column headings, we can use other series of numbers too, for instance the Fibonacci numbers and the factorials.

Factorial base

The factorial numbers count the number of permutations of n objects.
We can name the objects 1,2,...,n.
So the ways to permute 3 objects (to arrange them all in some order) are: 123, 132, 213, 231, 312, 321.
This is because there are 3 ways to choose the first number, any of the remaining 2 can go next and the 1 value left over goes in the final place, making 3×2×1 permutations. Similar reasoning shows there are 4×3×2×1 permutations of 4 objects. For n objects there are n! = n×(n−1)×...×3×2×1 permutations, called factorial n.
n123456
n!12624120720
These numbers can be used as the columns of a mixed base system, arranging them in reverse order: ..., 5!, 4!, 3!, 2!, 1!. The digits allowed in each column depend on the column number: the first column (1!) is 0,1; the second column (2!) can have digits 0,1 or 2; and in general the n-th factorial column can have 0,1, up to the column number n.
This is because n in column n means n×n! but (n+1)×n! is (n+1)!, which "carries" to the next larger column heading (on the left).
To indicate numbers in this base, we list the "digits" and use the exclamation mark "!" as the base. For example
6 = 1×3! = {1,0,0}!
7 = 1×3! + 1×1! = {1,0,1}!
8 = 1×3! + 1×2! = {1,1,0}!
9 = 1×3! + 1×2! + 1×1! = {1,1,1}!
10 = 1×3! + 2×2! = {1,2,0}!
23 = 3×3! + 2×2! + 1×1! = {3,2,1}!
24 = 1×4! = {1,0,0,0}!
Here are a few numbers in the factorial base:
n123456789101112
n!110112021100101110111120121200

Easy methods of converting to and from the Factorial Base

To convert a number to base !:

We can adapt the easy method to convert a number to base β above for converting a (decimal) number to base !. This time we start by dividing by 2 and the divisor increases each time.
Here is an example to convert 69 to base !:
69
34rem=1 69 = 2×34 + 1
11rem=134 = 3×11 + 1
2rem=311 = 4×2 + 3
0rem=22 = 5×0 + 2

To see the base ! representation, write down the reminders from the bottom to the top:
69 = 2311!
To convert a base ! representation to decimal:
  1. First write the multipliers above each digit by starting from the right with 2 and proceed leftwards with multipler 3 then 4 and so on. We will not use the leftmost 'multiplier' above the leftmost digit.
  2. Start with the most significant digit (the leftmost digit) which is the initial 'sum'
  3. Multiply the sum by the next column multiplier on its right ...
  4. ... and then add on the 'digit' under that multiplier to make the new 'sum'
  5. Repeat the previous two steps of multiplying and adding until you have a 'sum' under the final (rightmost) digit which is the decimal value
For example, using the same numbers as the example above, we have: To convert 2311! to decimal:
multiplier432
! digits2311
sum×
multiplier
83368
sum2113469
2311! = 69

Tests for Divisibility in Base Factorial

Every factorial from n! onwards is a multiple of n.
So to test if any given factorial base representation is divisible by n, we only need to test the number represented by the last n−1 'digits'.
For instance, to test if n! is divisible by 2=2!, look only at the last 'digit'. If it is 0, n is even, divisible by 2; if it is 1, the number is odd.

For divisibility by 3, test only the last 2 'digit's. if they are {1,1}! or {0,0}! then n is a multiple of 3; otherwise it is not.

There are 6 possibilities for the final 3 'digits' to test if a value is a multiple of 4. Show them

0 = {0,0,0}
4 = {0,2,0}
8 = {1,1,0}
12 = {2,0,0}
16 = {2,2,0}
20 = {3,1,0}
For larger divisors d, convert only the final d digits to base 10 and then test.
These divisibility tests are an advantage only if we are dealing with very large numbers and testing for small divisors.

The Fibonacci Base

The Fibonacci Numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, ... where each is the sum of the previous two numbers.
It has many interesting mathematical properties.
As a number base system, we again label the columns in order increasing to the left: 8, 5, 3, 2, 1 with just a single column labelled 1.
What about digits? We can use 0 and 1 in every column and that is sufficient to write any number n is the Fibonacci base system. In this system, we write the numbers as a binary number but the base is "F" for Fibonacci. It gives rise to several representations:
3 = 100F = 2 + 1 = 11F
We can restore a unique Fibonacci representation for every number by excluding represenations that have "..11.." in them. We can always eliminate these because the sum of two neighbouring columns headings is the next larger column heading as this is the "Fibonacci Rule" for making the sequence. This is called the Zeckendorf Represenation. On the rest of this page, the Fibonacci base system will mean choosing the Zeckendorf representation that does not have two consecutive ones anywhere.
In the following table we list all Fibonacci representations but put the Zeckendorf form (which uses the minimum number of 1s) at the top:
Columns in the Fibonacci base as ..., 8, 5, 3, 2, 1
Columns in the Fibonacci base are ...8 5 3 2 1
n0123456789
nF0110100
11
1011000
110
1001
111
101010000
1100
1011
10001
1101

To convert to and from Base Fibonacci

There are usually many Fibonacci representations of a number using only the 'digits' 0 and 1 in every column and with the column headings (in reverse order): 1, 2, 3, 5, 8, 13, 21, ...
An easy method of converting a number to base F will give the Zeckendorf represenation which happens to have the last number of 1s in any of the many representations for the number.
  1. Write the Fibonacci column headings, in order from right to left, from 1,2,... until the column headings are larger than the value to be converted
  2. Start by writing the decimal number to be converted above the leftmost column header
  3. If the column heading is larger than the number, put a 0 in that column and keep the number to use on the next column on the right; Otherwise if the column header is not larger than the number, Subtract the column header value from the number and write a 1 in the column
  4. repeat the step above on the same or, if you did the subtraction, the reduced decimal number
  5. after the rightmost column you should have reached 0.
    If not, you've made a mistake so check your previous steps!
  6. Each column now has a 0 or 1 in it which is the Fibonacci (Zeckendorf) representation
For instance here we convert 52 to base Fibonacci:
A: number52 18 18 5 5 00 0
B: Fib col
heading
55 34 21 13  8  5  3  2  1
A-B
or A
18 18 5 5 0 0 0 0
F digit1 0 1 0 1 0 00
52 = 10101000F
To convert from base Fibonacci, write the column headings above the digits and add the column headings above each digit '1'.

Irrational Bases

What if our column headings were powers of an irrational number, such as Phi, the golden section number 1.6180339... = (√5 + 1)/2?

Base Phi

Because Phi2 = Phi + 1 (a definition of the positive number Phi), we only need "digits" 0 and 1, called "phigits"!
The basic Phi rule is Phin+2 = Phin+1 + Phin. All natural numbers are representable in Base Phi using phigits 0 and 1 but we will need negative powers and so we need a "base point" to act like the decimal point in bse 10.
Just as for Fibonacci base numbers above, we need never have two 1's next to each other since they combine to give a 1 in the next column to the left using the basic Phi rule.
Here Phi = 1·6180339... = phi–1
and phi = 0·6180339... = Phi – 1 = 1/Phi = Phi–1
Phi
power
phi
power
A + B Phi C + D phireal
value
Phi5 phi-5 3 + 5 Phi 8 + 5 phi 11·0901699..
Phi4 phi-4 2 + 3 Phi 5 + 3 phi 6·8541019..
Phi3 phi-3 1 + 2 Phi 3 + 2 phi 4·2360679..
Phi2 phi-2 1 + 1 Phi 2 + 1 phi 2·6180339..
Phi1 phi-1 0 + 1 Phi 1 + 1 phi 1·6180339..
Phi0 phi0 1 + 0 Phi 1 + 0 phi 1·0000000..
Phi-1 phi1 -1 + 1 Phi 0 + 1 phi 0·6180339..
Phi-2 phi2 2 - 1 Phi 1 - 1 phi 0·3819660..
Phi-3 phi3 -3 + 2 Phi -1 + 2 phi 0·2360679..
Phi-4 phi4 5 - 3 Phi 2 - 3 phi 0·1458980..
Phi-5 phi5 -8 + 5 Phi -3 + 5 phi 0·0901699..
For instance 2 is 10.01Phi.

Base phi

phi = 1/Phi = Phi-1 = 0.6180339... = (√5-1)/2 and the basic phi rule is phin = phin+1 + phin+2.
Because Phi−n = phin it is easy to see that to get a base phi representation from a base Phi representation we merely reverse the order of the phigits including the base point:
4 = 101.01Phi = 10.101phi
6 = 1010.0001Phi = 1000.0101phi

More on base Phi

Base Converter

In a number is written in a base (β) which is bigger than 10, we cannot tell if 11β means 11×1 = 11 or if it represents 1×b+1 = β + 1.
Often new "digits" are used which conventionally are letters so that the "digit" 10 is A, 11 is B, ..., 35 is F.
The digits in increasing order from 0 to 35 are therefore 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is called the "9A" format on this page.
But for bases beyond 36 we need even more new "digits"!
An alternative is to list the decimal values of every column, enclosed in {} brackets so that 13 = {1,1}12 and 11 = {11}12. This is called the "{}" format on this page.
On the Calculators on this page: Use ! for the factorial base and F for the Fibonacci base.

Base Calculator

Base C A L C U L A T O R
Allow any 'digit':
from base to base
from 10
to 10
for bases

R E S U L T S Format base 11-36 numbers as



 

Link and References


Valid HTML 4.01! © 2018 Dr Ron Knott ronknott at mac dot com    Dr Knott's Maths Fibonacci and HOME page
created: 20 August 2017
updated: 9 February 2018