CIT 591 Balanced Ternary
Fall 2010, David Matuszek

Balanced ternary is an unusual, but mathematically quite beautiful, number system. It has the characteristic that all numbers can be represented in a uniform notation; you don't need a minus sign to indicate that "this number is negative." If you enjoy playing around with numbers, you will probably like it.

The decimal number system uses ten digits, `0` through `9`, and a system in which each position in a number is worth ten times the value of the position to its immediate right. Thus, for example, the number `7204` indicates "seven thousands, two hundreds, no tens, and four":

103 = 1000 102 = 100 101 = 10 100 = 1
`7` (times 103 is 7000) `2` (times 102 is 200) `0` (times 101 is 0) `4` (times 100 is 4)
`7`*103 + `2`*102 + `0`*101 + `4`*100 = `7204`

Similarly, the ternary system uses three digits, usually `0`, `1`, and `2`, and a system in which each position in a number is worth three times the value of the position to its immediate right.

In a balanced ternary system, the three digits have the values `0`, `1`, and `-1`. To avoid the awkwardness of using two characters, `'-'` and `1`, to represent a single digit, we will instead use `N` to stand for the digit `-1`. Similar to the above example, then, the number `10N1` indicates "one `27`, no `9`s, negative one `3`s, and one` 1`:

33 = 27 32 = 9 31 = 3 30 = 1
`1` (times 33 is 27) `0` (times 32 is 0) `N` (times 31 is 0) `1` (times 30 is 1)
`1`*33 + `0`*32 + `(-1)`*31 + `1`*30 = `10N1` (or, in decimal, 27 + 0 - 3 + 1 = 25)

In balanced ternary, as in more familiar number systems, there is exactly one way to represent any (integer) number. Unlike familiar number systems, there is no need for an additional symbol to indicate that a number is negative; for example, `-5` is represented as `N11`

Here are some more examples:

 Balanced ternary Decimal equivalent `N00` `N01` `N1N` `N10` `N11` `NN` `N0` `N1` `N` `0` `1` `1N` `10` `11` `1NN` `1N0` `1N1` `10N` `100` `-9` `-8` `-7` `-6` `-5` `-4` `-3` `-2` `-1` `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`

The balanced ternary system can easily be extended to real numbers, for example, `N01.1NN`. However, we will just use integers.

There is a good, more detailed article on balanced ternary numbers in Wikipedia.