Some useful formulae
This page will be updated from time to time
Geometric series
For any number r,
1 + r + r2 + ... + rn = SUM(k=0...n) rk =
(1 - rn+1) /(1 - r), and
r + r2 + r3 + ... + rn = SUM(k=1...n) rk =
(r - rn+1)/(1 - r).
Thus, if |r| < 1 then taking the limit n -> infinity,
1 + r + r2 + r3 + . . . = SUM(k=0... infinity) rk
= 1/(1-r), and
r + r2 + r3 + . . . = SUM(k=1...infinity) rk = r/(1-r).
Combining the above formulae, we obtain,
rm + rm+1 + ... + rm+k = rm(1 + r + r2 +
. . . + rk) = (rm - rm+k+1) / (1 - r ), for any r, and
rm + rm+1 + rm+2 + . . . = SUM(k=m... infinity) rk =
rm(1 + r + r2 + . . . ) = rm /(1 - r) for |r| < 1.
Decimal, binary, and ternary expansions
Let x be any number in [0,1], and [x]a denote the expansion of x (or the
representation of x) in base a (a can be any positive integer).
Decimal expansion (a=10):
[x]10=.d1d2d3. . . , where di= 0, 1, 2,
... or 9.
Then x = d1/10 + d2/102 + d3/103. . .
Binary expansion (a = 2):
[x]2=.b1b2b3. . . , where bi= 0 or 1.
Then x = b1/2 + b2/22 + b3/23. . .
Ternary expansion (a = 3):
[x]3=.c1c2c3. . . , where ci= 0, 1 or 2.
Then x = c1/3 + c2/32 + c3/33. . .
For numbers greater than 1, there would be digits to the left of the point for the positive powers of a.
Note that some numbers may have two expansions. For example, [1/10]10 = .1 and
.099(99). Also, [3/4]2=.11 and also .1011(11). Another, [7/9]3=.021 and
also .02022(22) (this can be seen by adding up the infinite series using the geometric formula above).
(Here, (ab) denotes the repeating pattern abababab..... )
Here's the algorithm for computing the ternary expansion of a number x between 0 and 1
(there's a similar algorithm for other bases and if the number is greater than 1). Here we want to determine
c1, c2, c3, . . . where each ci is either 0, 1, or 2 such that
x = c1/3 + c2/32 + c3/33 + ... .
Determine c1;
- if 0 < x < 1/3, then c1 = 0
- if 1/3 < = x < 2/3, then c1 = 1
- if 2/3 < = x < 1, then c1 = 2
- let x1 = x - c1/3 (note that x1 < 1/3 )
Determine c2;
- if 0 < x1 < 1/32, then c2 = 0
- if 1/32 < = x < 2/32, then c2 = 1
- if 2/32 < = x < 1/3, then c2 = 2
- let x2 = x1 - c2/32 (note that x2
< 1/32)
Determine c3;
- if 0 < x2 < 1/33, then c3 = 0
- if 1/33 < = x2 < 2/33, then c3 = 1
- if 2/33 < = x2 < 1/32, then c3 = 2
- let x3 = x2 - c3/33 (note that
x3 < 1/33)
etc.