This tutorial is very hard to understand. not because it is written poorly

but because it is a difficult subject. it show you how to change arithimic

bases and allows you to encode, decrypt messages using this method and possibly

in the future decode alien messages. for all we know aliens have a different number

system and this is a way we can communicate. Dont give out AntiPionts unless you

fully understand this.

A Primer on Arithmetic in Bases Other Than 10

The ordinary arithmetic problems we're used to seeing are all based on decimal (or base-10) numbers, but systems using a base other than 10 are possible. In all systems, the position of a digit in a number determines the value it contributes; for example, the base-10 number 2347 represents an implied addition problem:

2347 (10) = 2 x 1000

+ 3 x 100

+ 4 x 10

+ 7 x 1

Here we've included "(10)" after the number to emphasize that base 10 is being used. Note that the value multiplied by each digit increases by a factor of 10 as you move each position to the left, with the rightmost digit always representing ones. This use of the base to distinguish the role of each digit in a number is the key to understanding arithmetic in all bases. For example, the same sequence of digits in base 8 (octal) would translate to

2347 (8) = 2 x 512

+ 3 x 64

+ 4 x 8

+ 7 x 1

= 1255 (10)

Again, note that the value multiplied by each digit increases by a factor of 8 (the base) as you move each position to the left. These multipliers are referred to as powers of the base; for example,

Base 10 Base 8

10 = 10 8 = 8

100 = 10 x 10 64 = 8 x 8

1000 = 10 x 10 x 10 512 = 8 x 8 x 8

etc.

As seen in the conversion above, it's fairly easy to translate a non-decimal number into base 10, but the opposite conversion is a bit trickier. The procedure can best be illustrated by means of a specific problem, for example converting the decimal number 1255 (10) into base 8.

First, we begin by finding the largest power of the base present in the starting number. Since 8 x 8 x 8 x 8 = 4096 (10) is larger than 1255 (10), we next try 8 x 8 x 8 = 512 (10), which does factor at least once into 1255 (10):

1255 = 2 x 512 + remainder

In fact, 2 multiples of 512 (10) can be found in 1255 (10) - this 2 then becomes the first digit in our base-8 equivalent.

To find the next base-8 digit, start by removing the effect of the first digit, which changes the starting number from 1255 (10) to 231 (10):

1255 - 2 x 512 = 231

The procedure is repeated with the new starting number and the next smaller power of 8 to come up with the second base-8 digit:

231 = 3 x 64 + remainder

Continuing the process eventually results in the definition of all base-8 digits:

1255 (10) = 2 x 512

+ 3 x 64

+ 4 x 8

+ 7 x 1

= 2347 (8)

Any single digit in a number can never be as large as the base - the maximum digit in a decimal number is 9, and the maximum in a base-8 number is 7. For bases larger than 10, we must introduce other symbols for values above 9 - letters are usually the convention. In base 16 (hexadecimal), we have the possible digits

0 1 2 3 4 5 6 7 8 9 A B C D E F

For example, C (16) is equivalent to 12 (10).

Unless you have a translating calculator or other aid, it's usually easiest to solve complex arithmetic problems in non-decimal bases by first converting all numbers to base 10, performing the arithmetic, then converting the answer back to the desired base. For simple addition problems, an analog of the decimal columnar method may be used; for example in base 8,

1 <--- carry digit 5 3 + 2 7 1 0 2

Here are some examples of arithmetic problems in various bases:

Base 3 Decimal Equivalent

1 + 2 = 10 1 + 2 = 3

10 - 1 = 2 3 - 1 = 2

21 + 12 = 110 7 + 5 = 12

21 - 12 = 2 7 - 5 = 2

1201 - 111 = 120 46 - 13 = 33

Base 8 Decimal Equivalent

2 + 4 = 6 2 + 4 = 6

7 - 2 = 5 7 - 2 = 5

53 + 27 = 102 43 + 23 = 66

52 - 41 = 11 42 - 33 = 9

13053 + 17345 = 32420 5675 + 7909 = 13584

Base 16 Decimal Equivalent

A + 4 = E 10 + 4 = 14

D - B = 2 13 - 11 = 2

24 + 12 = 36 36 + 18 = 54

FF - AA = 55 255 - 170 = 85

1F40 + 5A8F = 79CF 8000 + 23183 = 31183