Section 1: Base-n Concepts

Base-n is a family of notations for integer numbers.

Section 1 Content

You already know three notations for numbers:
        Decimal (same as Base-10)
        Tallies
        Roman Numerals
You will learn a new kind of notation for numbers:
        Positional Notation
        Money in Toon Land
        Base-n Notation


Decimal Notation (1.1)

The decimal number system (called arabic numerals) is a positional number system.

It only has symbols for the first ten values, including a symbol for zero. The only symbols in decimal are: 0 1 2 3 4 5 6 7 8 and 9.

Contrast this with Roman Numerals where 1 has the symbol I, but 10 has the symbol X, and 100 has the symbol C, and 1000 has the symbol M.

The reason that only ten symbols are needed (no matter how huge the number may be) is that the value contributed by a symbol depends on its position. The symbol is multiplied by its positional value.

Thus in the decimal number, 3257, the 3 is multiplied by a thousand, the 2 is multiplied by a hundred, the 5 is multiplied by ten, and the 7 is multiplied by 1 (namely not changed at all).

Compare the decimal number 1111 with the Roman numeral MCXI and note that the decimal number only uses one symbol (1) whereas the Roman numeral requires four symbols(M,C,X,I).

The positional values are powers of 10:


Tally Notation (1.2)

The Tally number system, simply makes a mark for each item being counted.

You have probably used the "Tally" number system when counting votes in a club election. One common method is to write down each candidate's name with space beside it and to make a mark beside the candidate each time he receives a vote. A refinement of the system is to make the fifth mark in a group at an angle through the others - making nice packets of five that can be more quickly counted.

Here are some decimal numbers and their translations into the Tally number language:

The Tally number notation is actually a primitive precursor of base-5 notation, but it is not a positional notation.


Roman Numerals (1.3)

Roman numerals are an advanced tally system with some positional features.

To see the relation with the tally system consider the first three nonzero integers in both decimal and Roman numerals:

However, the value 4 is written using a "slick trick".

Roman numerals use the rule that a preceeding smaller valued symbol is subtracted from the resulting value rather than added. This is the positional feature mentioned above.

So the Roman numeral IV does not mean (1+5) but rather (-1+5).

You perhaps recall that each power of ten has its own symbol in Roman numerals:

Multiples of five also have their symbols, kind of like grouping by fives in the tally system.

As an example the Roman numeral:


Positional Notation (1.4)

A positional number notation makes the value contributed by a numeric symbol depend on its position, so that the same symbol can be used over and over for different values.

For example the same digit 2 used in each of the decimal numbers 200, 20, and 2 contributes a different value in each number.

Decimal notation and base-n notations are positional.

Tally notation is not positional.

Roman numerals are kind of both, since the I in IV means subtract one whereas the I in VI means add one. However the V has the same value in both IV and in VI. And, ten is not represented by I in a different position (as in decimal 10) but by a different symbol altogether(namely X).

So Roman numerals are not really a positional system.


Money in Toon Land (1.5)

Take a good look at a "Toon" (a cartoon creature) and you will probably only see six fingers (three on each hand).

So money in Toon Land has denominations that are based on groupings of six.

Here are the coins and paper money used in Toon Land:

Thus changing each of the denominations into pesos gives:

Not only is the money in Toon Land based on sixes, but the number notation is also based on sixes. Hence:

For example, if you had 3 mickeys, two freds, no plutos, 4 ducats, and one peso, you would write down your money as:

32041p

Try to work out how many pesos this is in American:

So the grand total is 3888+432+0+24+1 = 4345 pesos.

Using the symbol * to mean multiply, the grand total can be written in "algebra" as:

This Toon Land number system is known to mathematicians as "base-6" numbers or hexary notation.


Base-n Notation (1.6)

Base-n
notation is a system for writing numbers which uses only n different symbols. It does this by using a positional system.

Base-n Radix

When numbers are written in base-n notation, then the number n is called the radix of those numbers.

The radix for a written number is often given as a subscript at the right end of the number.

Thus, for example, the notation 34158 is a number written in base-8 notation (namely in octal notation).

When the radix subscript is omitted, it often means that the number is written in decimal notation.



Section 2: Base-n to Decimal

Here are two of the algorithms for translating numbers from base-n notation to decimal.

        Right-to-Left
       Left-to-Right


Base-n to Decimal (Right to Left) (2.1)

This algorithm is given in static form

Description of Problem

A number written in Base-n is given. The radix n is also given. Write the same number in decimal notation.

Set up

Draw a box labeled "radix". Beneath that, draw a table of boxes with three columns and as many rows as there are digit symbols in the given base-n number. Finally under the third column, draw a box labeled "sum"

Parameters

  1. Record the given radix n in the "radix" box.
  2. Record the digits of the given base-n number in the first column, STARTING AT THE BOTTOM, so that they are in upside down order.

Execution

  1. Record the number 1 into the top box of the second column of the table.
  2. In each remaining box in the second column, record the product of the number in the box above with the number in the "radix" box.
  3. In each box of the third column, record the product of the other two numbers in the same row.
  4. Add up all of the numbers in the third column and record the total in the "sum" box.

Conclusion

The desired decimal notation is in the "sum" box.


Here is an example calculation (aka execution) of this algorithm for the notation 31246. The number in decimal notation is the 700 in the "sum" box.

Base-n to Decimal (Left to Right) (2.2)

This algorithm is given in dynamic form .

Description of Problem

A number written in Base-n is given. The radix n is also given. Write the same number in decimal notation.

Set up

Draw three boxes labeled "radix", "digit", and "res".

Parameters

  1. Record the given radix n in the "radix" box.
  2. The digit symbols of the given base-n number will be requested in left to right order.

Execution

  1. Request the first digit (leftmost digit symbol) and record it in the "res" box.
  2. Repeat the following steps for each remaining digit of the given base-n number (remembering to work from left to right).
    1. Request the next digit and record it in the "digit" box.
    2. Compute the product of the "radix" box and the "res" box.
    3. Record the above product back in the "res" box.
    4. Compute the sum of the "digit" box and the "res" box.
    5. Record the above sum back in the "res" box.

Conclusion

The desired decimal notation is in the "res" box.


Here is an example calculation (aka execution) of this algorithm for the notation 31246. The final value recorded in each box is shown in black. The history of earlier values is shown in magenta. Note that the computer only retains the most recent recorded value in a box, so the magenta numbers are NO LONGER in the computer. The number in decimal notation is the 700 in the "sum" box.

Challenge:You should be able to work this algorithm on a calculator without using any boxes on paper at all - just reading the number to be translated to decimal, one digit at a time from left to right.

Section 3: Decimal to Base-n

Here are two of the algorithms for translating numbers from decimal into base-n notation.

        Right-to-Left
        Left-to-Right


Decimal to Base-n (Right to Left) (3.1)

This algorithm is given in static form .

Description of Problem

A number written in decimal notation is given. A non decimal radix n is also given. Write the same number in base-n notation.

Set up

Draw a box labeled "radix" and a box labeled "res". Beneath that, draw a table of boxes with two columns and several rows. Leave space at the bottom of the table to add more rows if it becomes necessary.

Parameters

  1. Record the given decimal number in the top box of the first column.
  2. Record the given radix n in the "radix" box.

Execution

  1. Repeat the following steps for each row in the table until a zero is entered into a box in the first column.
    1. Perform a long division which divides the number from the "radix" box into the first number in the row of the table.
    2. Record the quotient of that long division into the first number in the next row down.
    3. Record the remainder of that long division into the second number in the same row - but record it using a single base-n digit symbol.
  2. Record each of the symbols from the second column into the "res" box - BUT record them from right to left in that box. Thus the digits in the "res" box will be in reverse order from the digits in the second column.

Conclusion

The desired base-n notation is in the "res" box.


Here is an example calculation (aka execution) of this algorithm to convert the decimal number 700 into a base-6 notation. The base-6 number is the 31246 in the "res" box.

Long Division

Long division is an algorithm which you learned in grade school.

For example, if you long divide 14 into 54 you get a quotient of 3 and a remainder of 12.

Most calculators do NOT do long division.

Here is a "trick" for performing long division on an ordinary calculator

  1. Perform the ordinary calculator division of your two given numbers.
  2. Write down the integer part of the answer on a piece of paper - In other words ONLY write down the part to the LEFT of the decimal point. This will be your quotient.
  3. Subtract the whole number quotient (that you just wrote down) from the division result showing on your calculator.
  4. NOW, multiply by the same divisor used in step 1.
  5. If necessary, round the calculator result off to an integer value. This will be your remainder.


Writing Remainders as Single Digits

When the radix is greater than 10, then additional digit symbols are required.

Letters of the alphabet are usually used for these additional symbols as follows:

It is STRONGLY RECOMMENDED that you memorize all of the additional digit symbols from A to F. You will understand why later.

When a remainder is obtained after long division by the radix, that remainder may be greater than 9. In that case record the corresponding digit symbol A (or B or C or etc) INSTEAD of the decimal value.

For example, long division of 14 into 54 gives a quotient of 3 and a remainder of 12. DO NOT record "1" and "2" as two separate symbols. INSTEAD, record "C" as a single digit symbol.


Decimal to Base-n (Left to Right) (3.2)

This algorithm is given in dynamic form . This algorithm is not recommended for the average student.

Description of Problem

A number written in decimal notation is given. A non decimal radix n is also given. Write the same number in base-n notation.

Set up

Draw four boxes labeled "radix", "count", "res", and "work". The last box labeled "work" should be larger than normal, since it will have long decimal point numbers in it.

Record a zero in the "count" box.

Parameters

  1. Record the given decimal number in the "work" box.
  2. Record the given radix n in the "radix" box.

Execution

  1. Repeat the following steps as long as the number in the "work" box is greater than or equal to the number in the "radix" box.
    1. Divide the "radix" box into the "work" box and put the result back into the "work" box.
    2. Add 1 to the number in the "count" box and put the result back into the "count" box.
  2. Record the integer part of the "work" box as a single digit in the "res" box.
  3. Subtract the integer part of the "work" box from the "work" box and leave the result in the "work" box.
  4. Repeat the following steps as long as the number in the "count" box is greater than zero.
    1. Multiply the "work" box by the "radix" and leave the result in the "work" box.
    2. Record the integer part of the "work" box as a single digit in the "res" box. This recording should be from left to right as the algorithm progresses.
      NOTE that numbers like 3.99999999 should be treated as if they were rounded off (i.e. 4). This should only happen at the very end of the algorithm.
    3. Subtract the integer part of the "work" box from the "work" box and leave the result in the "work" box.
    4. Subtract 1 from the "count" box and leave the result in the "count" box.

Conclusion

The desired base-n notation is in the "res" box.


Here is an example calculation (aka execution) of this algorithm to convert the decimal number 700 into a base-6 notation. The base-6 number is the 31246 in the "res" box. All but the last value in each box is shown in magenta. Notice how many calculations are done in the "work" box - which is why it is drawn so large.

This algorithm is particularly useful on a hand calculator.

Section 4:Hex to Binary

It is almost too simple to be written formally as an algorithm.

BUT you will have to memorize the following table which gives the binary equivalent for every hexidecimal digit symbol.

Hex Digits

Hex
Binary
Decimal
Hex
Binary
Decimal
0
0000
0
8
1000
8
1
0001
1
9
1001
9
2
0010
2
A
1010
10
3
0011
3
B
1011
11
4
0100
4
C
1100
12
5
0101
5
D
1101
13
6
0110
6
E
1110
14
7
0111
7
F
1111
15

Now imagine being given some number in hexidecimal notation. It will be a sequence of hex digit symbols (0,1,2,...9,A,B,...F).

Just replace each hex digit symbol by its corresponding 4 digit binary pattern as memorized above.

You can do this left to right, or right to left, or inside out, or whatever. Just make SURE you replace each hex (i.e hexidecimal) digit by the corresponding 4 bit pattern.


Here are a few examples. The bits have been grouped into fours by inserting blanks. This is useful for humans to help them read the binary. However, the computer just stores the 0s and 1s - NOT the blanks. The leading zeros in the resulting binary are sometimes omitted.

Section 5: Binary to Hex

If you read about Hex to Binary, this is just the reverse.

Group the bits into groups of four each - STARTING FROM THE RIGHT. If you run out of bits on the left, just add however many leading zero bits that you need.

Then replace each group of four bits by the corresponding hex digit symbol (0,1,2,...,9,A,B,...,F).


Here are a few examples. The binary is first grouped into fours and then translated to hex.

Section 6: Binary to Decimal

Provided you have memorized your powers of two, there is another algorithm for converting binary numbers to decimal ones. Set up a column of numbers that could have as many numbers as there are bits in the given binary number. Work through the binary number from right to left one bit at a time. While you are doing this, mentally work through the powers of two. Everytime you see a bit equal to 1, append the corresponding power of two (that is in your mind) onto the column of numbers. Everytime you see a bit equal to 0, just go on to the next bit and the next power of two. When you are all done, add up all of the powers of two you wrote down - that will be the decimal equivalent of the given binary number.

For example consider the binary number 1 0 0 1 0 1 1 1

In the table below , the bit being considered at each step will be shown as an X in the first column and the corresponding power of two will be in the second column.

1 0 0 1 0 1 1 X
1
1 0 0 1 0 1 X 1
2
1 0 0 1 0 X 1 1
4
1 0 0 X 0 1 1 1
16
X 0 0 1 0 1 1 1
128

Note that we skipped 8, 32, and 64 because those powers of two occurred while we were looking at a zero bit.

The final answer is 1+2+4+16+128 = 151

For the above reason and several others, you are expected to memorize the following table of powers of two:

0
1
8
256
1
2
9
512
2
4
10
1024
3
8
11
2048
4
16
12
4096
5
32
13
8192
6
64
14
16384

7

128

15

32768

16
65536

 


Copyright © 2001 Dr. James F. Wirth