Base zero is silly: each integer is alone in its equivalence class mod 0, so you need infinitely many digits. All integers are equal mod 1, so we only get one digit. Any representation is then a sequence of instances of our one digit, each muliplied by power(position,1) = 1 and summed: so we get the digit times the representation's length as the number represented. Thus, using 1 as digit, we get the positive integers (if you can recognise when the empty string is present with this meaning, you can also represent the number zero to get the natural numbers).

Base two allows us the convenience of a non-empty representation of zero: namely as a digit. If we'd used it as such in base 1, all representations would have been sequences of zeroes, representing zero: no others would have been representable. However, in higher bases, it proves hugely useful - it enables us to effectively skip a few positions in the digit-sequence used, without the digit used as spacing interfering in the value. We have two equivalence classes mod 2, and 0 is even, so the other digit must be odd. We'll then be able to represent any multiple of that digit, so (again) we naturally take 1 as our digit. This gives us the widely-used binary system: these digits are known as bits.

As in base 2 (and all higher), it's very convenient to select 0 as one of our digits base 3: we then need digits equivalent to 1 and 2. A fairly conventional and easy solution is then to use {2,1,0} as digits. You might enjoy playing with that for a while. While 1 makes a winning candidate for its equivalence class, 2 is equivalent to -1 and there's some much nicer symmetry to {1,0,-1}. This has the nice property of making truncation `fair': zeroing the last few digits of a number (or all those, of a fraction's representation, past some point) changes as many numbers upwards as downwards. Using {0,1,2}, that introduces a systematic bias (averaging one in the first position discarded): but {1,0,-1} eludes that bias.

Consider (in decimal) rounding 2.45 to the nearest .1 and to the nearest 1.
The latter gives 2: the former gives 2.5. Rounding this last to the nearest 1,
we get 3. If we'd started with 2.444445, with arbitrarily many 4s before the 5,
and rounded successively at each position, we'd get to 2.45 on the way, and
hence end at 3. This is, in fact, a general difficulty with an even base (even
if signed). On the other hand, in an even base, we can always truncate to one
digit short of where we want to round, and get the right result by rounding that
truncated form (because `half' has a digit to represent it exactly): by
contrast, in base 9, 2.444445 is nearer to 3 than to 2 (since 3 - 2.444445 is
.444444), but if you truncate 2.444445 you'll lose the 5 and get a number nearer
to 2 than to 3. However, in an odd base we can use a 0-centered set of digits,
which will make truncation *be* rounding to nearest, which keeps it free
of the two defects discussed, one for odd natural bases the other for even
bases. Then again, representing 1/2 involves chosing which way you want it
rounded ...

rounds to 2, but 2.45 rounds
to 2.5 which rounds to 3.
In any base with natural (*ie* non-negative) digits, the result of
rounding to nearest at one granularity (*eg* two significant digits to the
right of the point) is capable of differing from the result of rounding
*via* the result of rounding to some finer granularity: the initial fine
rounding may have changed the last digit it kept and, thereby, changed the
coarser rounding's result. At least in an odd base, using a 0-centered set of
digits turns truncation into `rounding to nearest': and truncation does (by
definition) allow rounding *via* intermediates.

Use -1, 0 and +1 as the digits for representing numbers, base 3. It may be worth doing experiments in base 9 with {-4, ..., 0, ..., +4} as digits if you want to learn by playing with arithmetic - and one might sensibly describe signed ternary, by bunching up the digits in pairs, in this form.

Written by Eddy.$Id: prial.html,v 1.2 2001-10-17 17:11:30 eddy Exp $