Ordered list of fractions
A |
B |
C |
D |
E |
F |
G |
H |
Decimal count |
Binary count |
Continued |
Fraction |
S-B tree: |
If inequality is ‘>’ then fraction is > 1 |
S-B tree term location |
Decimal count |
1 |
1 |
1 |
1/1 |
1, 1 |
- |
- |
- |
2 |
10 |
0; 1, 1 |
1/2 |
2, 1 |
1 = 2(2 - 1)/2 |
(22 – 2)
/ 2 = 1 |
22 - 2 (1)
= 2 |
3 |
11 |
2 |
2/1 |
2, 2 |
2 > 2(2 - 1)/2 |
(3 + 1) / 2 = 2 |
2 (2) – 1 = 3 |
4 |
100 |
0; 1, 2 |
2/3 |
3, 2 |
2 = 2(3 - 1)/2 |
(23 – 4)
/ 2 = 2 |
23 - 2 (2)
= 4 |
5 |
101 |
1; 1, 1 |
3/2 |
3, 3 |
3 > 2(3 - 1)/2 |
(5 + 1) / 2 = 3 |
2 (3) – 1 = 5 |
6 |
110 |
0; 2, 1 |
1/3 |
3, 1 |
1 < 2(3 - 1)/2 |
(23 – 6)
/ 2 = 1 |
23 - 2 (1)
= 6 |
7 |
111 |
3 |
3/1 |
3, 4 |
4 > 2(3 - 1)/2 |
(7 + 1) / 2 = 4 |
2 (4) – 1 = 7 |
8 |
1000 |
0; 1, 3 |
3/4 |
4, 4 |
4 = 2(4 - 1)/2 |
(24 – 8)
/ 2 = 4 |
24 - 2 (4)
= 8 |
9 |
1001 |
1; 2, 1 |
4/3 |
4, 5 |
5 > 2(4 - 1)/2 |
(9 + 1) / 2 = 5 |
2 (5) – 1 = 9 |
10 |
1010 |
0; 1, 1, 1, 1 |
3/5 |
4, 3 |
3 < 2(4 - 1)/2 |
(24 – 10)
/ 2 = 3 |
24 - 2 (3)
= 10 |
11 |
1011 |
1; 1, 2 |
5/3 |
4, 6 |
6 > 2(4 - 1)/2 |
(11 + 1) / 2 = 6 |
2 (6) – 1 = 11 |
12 |
1100 |
0; 2, 2 |
2/5 |
4, 2 |
2 < 2(4 - 1)/2 |
(24 – 12)
/ 2 = 2 |
24 - 2 (2)
= 12 |
13 |
1101 |
2; 1, 1 |
5/2 |
4, 7 |
7 > 2(4 - 1)/2 |
(13 + 1) / 2 = 7 |
2 (7) – 1 = 13 |
14 |
1110 |
0; 3, 1 |
1/4 |
4, 1 |
1 < 2(4 - 1)/2 |
(24 – 14)
/ 2 = 1 |
24 - 2 (1)
= 14 |
15 |
1111 |
4
|
4/1 |
4, 8 |
8 > 2(4 - 1)/2 |
(15 + 1) / 2 = 8 |
2 (8) – 1 = 15 |
16 |
10000 |
0; 1, 4 |
4/5 |
5, 8 |
8 = 2(5 - 1)/2 |
(25 – 16)
/ 2 = 8 |
25 - 2 (8)
= 16 |
17 |
10001 |
1; 3, 1 |
5/4 |
5, 9 |
9 > 2(5 - 1)/2 |
(17 + 1) / 2 = 9 |
2 (9) – 1 = 17 |
- The simple continued fraction of \( \frac{19}{30} \) is [0; 1, 1, 1, 2, 1, 2], by the Euclidean Algorithm.
- The sum of the terms is 0 + 1 + 1 + 1 + 2 + 1 + 2 = 8. Therefore \( \frac{19}{30} \) is on the 8th row of the Stern-Brocot tree, which has 2(8 - 1) =128 terms. (The n-th row of the Stern Brocot tree means the row containing \( \frac{1}{n} \))
- The index binary number is 10100100, being 1's and 0's in alternating segments of length corresponding to the terms of the continued fraction.
- The index decimal number is 4 + 32 + 128 = 164, being 10100100 expressed in decimal.
- By calculation in Column G for even index numbers: (28 - 164) / 2 = 46
- The location of \( \frac{19}{30} \) is in the 46th place (counting inclusively from left) in row 8, out of 27 =128 terms in total in row 8.
- From Column F, 2(10 - 1) / 2 = 256, being half the number of terms in the tenth row. 301 > 256, therefore the fraction sought is greater than 1. Its index number is odd. Fractions greater than 1 have an odd index number.
- From Column H, using the equation for an odd index number, 2 (301) - 1 = 601. 601 is therefore the decimal index number of the fraction that is sought.
- 601 in binary is 1001011001, being 512 + 64 + 16 + 8 + 1.
- From Column C, the continued fraction that is sought is [1; 2, 1, 1, 2, 2, 1]
- By calculating the continued fraction, the simplified fraction is \( \frac{61}{44} \), which is the 301st term (counting inclusively from the left) of row 10 of the Stern-Brocot tree out of 512 terms in total on row 10.
The index begins with the counting numbers in decimal (Column A). Each number is translated into binary form (Column B). The binary numbers encode a continued fraction based on the successive segments of terms containing alternately 1 and 0. For example, line 12 is twelve in binary, which is 1100, being two 1's followed by two 0's. The continued fraction is [0; 2, 2] (Column C). The resulting fraction is \( \frac{2}{5} \) (Column D).
From a given fraction, the index number can be calculated via the simple continued fraction. Every fraction has two simple continued fraction expressions. By convention of this index, one of the two simple continued fraction expressions is used for a fraction with a value less than 1 and the other for its inverse. Even index numbers (binary form ending in 0) refer to fractions less than one and odd index numbers (binary form ending in 1) refer to fractions greater than (or in one instance equal to) one.
Column E lists the location of the indexed fractions on the Stern-Brocot tree by row and term. Row 1 has one member, \( \frac{1}{1} \); row 2 has two members, \( \frac{1}{2} \) and \( \frac{2}{1} \) and so on. Terms are counted inclusively from the smallest value on the left of a row. For example, the first term of the third row is \( \frac{1}{3} \) and is expressed as (3, 1).
Column G calculates the location of a Stern-Brocot term from a known fraction via its index number. The calculation differs, depending upon whether the index number is odd or even. The number of the Stern-Brocot row is deduced from the number of digits in the known index term expressed in binary. For even numbers, the location of the Stern-Brocot term within the row (counting inclusively from the left) is given by (2 (row number - index number) ) /2. For odd numbers, the location of the Stern-Brocot term is given by (index number + 1) / 2.
Column H calculates an index number (and thence a fraction) from a known Stern-Brocot location. Suppose that it is known only that some fraction is the j-th term on the k-th row of the Stern-Brocot tree. From this information the value of that fraction can be calculated. First, the calculation in column F establishes whether the fraction is greater or less than 1. If the fraction is greater than one, its index number is given by 2k - 2j . If the fraction is less than one, then its index number is given by 2j - 1. In the latter case it is surprising that the calculation does not use the Stern-Brocot row number. The reason for this is discussed below. From the index number the continued fraction and the fraction itself can be calculated.
Patterns in the index
By convention in the design, an even index number refers to a fractions less than one and the following odd index number refers to its inverse.
In this index all binary encodings begin with a '1'. The longer the first string length of '1's, the higher the value of the first non-zero term of the corresponding continued fraction. For example, considering even numbers, 1000 represents [0;1,3] and 1100 represents [0;2,2]; the odd-number neighbours are respectively 1001 which represents [1; 3] and 1101 which represents [2; 2]. As even numbers increase - beginning with longer strings of '1's - and as the value of the first continued fraction term also increases, then the value of the continued fraction decreases. In this way the index encodes fractions less than one in decreasing order, row by row. Their inverses are encoded in increasing order. The pattern of index numbers in relation to the Stern Brocot tree is illustrated here below:
Validating the methods
The questions addressed here are;
- Completeness of the index. Does the index capture all simplified fractions?
- Parsimony of the index. Does the index capture only simplified fractions?
- Uniqueness of reference. Does each term of the index refer to exactly one fraction and vice-versa?
- Mapping to and from the Stern-Brocot tree. Does the index generate valid references to the Stern-Brocot tree and vice versa?
The first problem concerns the encoding of the whole number preceding the ';' in, for example, [1; 1, 2, 2]. This fraction could be encoded as 101100. The question then arises, how to encode the continued fraction [0; 1, 1, 2, 2]. This continued fraction begins with '0' and by the encoding rule the part preceding the ';' would be represented by a binary segment of zero length, which would not give any information.
The second problem concerns the fact that every fraction has two continued fraction expressions. The expression [1; 1, 2, 2] refers to the same fraction as does [1; 1, 2, 1, 1], namely \( \frac{12}{7} \). The binary representations would be: of the first 101100 and of the second 101101. In that way there would be two different encodings of the same fraction. The index would not refer uniquely.
In the example in the last paragraph the continued fraction is encoded as two consecutive binary numbers: 101100 plus 1 equals 101101. This is not a co-incidence.
If the binary representation is even (ends in 0), then that binary number represents a fraction less than 1.
If the binary representation is odd (ends in 1), then that binary number represents a fraction that is greater than 1.
Comments
Post a Comment