A little bit of history about balanced ternary numeral system.


As a specialist in IT technologies, I became interested deeper in history of the balanced ternary numeral system. Imagine my surprise when I found that it originates in well-known problem of "Choosing the best system of standard weights" or "Weighing Problem" of the French mathematician Claude Gaspard Bachet de Meziriac (c. 1581 – c. 1638), also formulated 400 years before, by Italian mathematician Fibonacci (c. 1170 – c. 1250). This task requires to find a set of four weights, with which you can weigh any cargo weighing from 1 to 40 kg.

So how the balanced ternary numeral system can help us to solve this problem?

Basically, as was mentioned in previous posts, it uses to represent numbers three digits {-1,0,1} which have a "natural" interpretation of measurement when we weigh unknown cargo Q with "ternary" weights, but let's go through it point by point.



Suppose, we have a 4 ternary weights 1 kg, 3 kg, 9 kg, 27 kg (30, 31, 32, 33) and suppose that our cargo Q takes the value of the natural numbers, that is, {1, 2, 3, ...}. Then for four ternary weights maximum load is the sum of all ternary weights, i.e. 40 = 1 + 3 + 9 + 27.
Weighing begins with top weights, and the result of the weighing is represented as a 4-places "ternary" number.
It is clear that for weighing load Q = 1 kg, it suffices to one weight of 1 kg which is placed on the right (that is, free from the load of Q) scales. Digital recording of this weighing is as follows:

1 kg
Ternary representation of decimal number 1
    0
    0
    0
    1
weights
  27kg
  9 kg
  3 kg
  1 kg

Weighing load Q = 2 kg will require the use of two weights: first, to "empty" bowl placed a weight of 3 kg and then a bowl with a load - 1 kg. The result of this weighing written in the form:

2 kg
Ternary representation of decimal number 2
    0
    0
    1
   -1
weights
  27kg
  9 kg
  3 kg
  1 kg

Note that in this measurement, ternary records appeared "negative" one -1, which reflects the fact that the corresponding weight is on the left side of the scale (i.e., on the bowl with load).
Clearly, the "ternary" entry for goods in 3 and 4 kg, respectively, have the following view: 3 kg = 0010 and 4 kg = 0011. It is more difficult express shipping 5 kg = 01-1-1. Loads 6, 7, 8, 9, 10 kg have the following ternary records:

6 kg
Ternary representation of decimal number 6
    0
    1
   -1
    0
weights
  27kg
  9 kg
  3 kg
  1 kg

7kg
Ternary representation of decimal number 7
    0
    1
   -1
    1
weights
  27kg
  9 kg
  3 kg
  1 kg

8kg
Ternary representation of decimal number 8
    0
    1
    0
   -1
weights
  27kg
  9 kg
  3 kg
  1 kg

9 kg
Ternary representation of decimal number 9
    0
    1
    0
     0
weights
  27kg
  9 kg
  3 kg
  1 kg

10 kg
Ternary representation of decimal number 10
     0
    1
    0
    1
weights
  27kg
  9 kg
  3 kg
 1 kg

and so on.

In general case, the n-positions representation of an integer decimal number N in the balanced ternary numeral system is as follows:


where Ci is the one of ternary digits {-1,0,1}.
For Example, number 7 can be represented in ternary as:  0×33 + 1×32 - 1×31 + 1×30 .

This is just one of the remarkable properties and practical applications of balanced ternary system, about others we well talk in the next posts.