Escolar Documentos
Profissional Documentos
Cultura Documentos
construction at 11FALL/Euclidextendpnew.tex
Franz Rothe
Department of Mathematics
University of North Carolina at Charlotte
Charlotte, NC 28223
frothe@uncc.edu
Contents
1
6 Reversing the Extended Euclidean Algorithm 33
7 Descartes Problem 35
References
[1] Stan Wagon, Editors Corner: The Euclidean Algorithm Strikes Again, The American
Mathematical Monthly, 97, Feb. 1990, pp.125-129.
[2] Stan Wagon, A Mathematical Magic Trick, The College Mathematical Journal, 25,
Sept. 1994, pp.325-326.
(1.2) a : b = q rem r
and
(1.3) ar mod b
Definition 1.2 (Greatest common divisor). The greatest common divisor of two
positive integers a and b is the greatest positive integer that is a divisor of both a and
b. We denote the greatest common divisor of a and b by gcd(a, b).
Definition 1.3 (Least common multiple). The least common multiple of two positive
integers a and b is the positive integer l such that
Intuitively, the greatest common divisor is the greatest common measure for the
lengths a and b. The least common multiple is the least common period of two simul-
taneous processes with individual periods a and b.
2
1.1 The Common Euclidean Algorithm
Let a, b be positive integers. The greatest common divisor gcd(a, b) can be calculated
by successive divisions with remainders. The algorithm starts with dividing a by b. The
last nonzero remainder is the greatest common divisor.
42 : 16 = 2 rem 10
16 : 10 = 1 rem 6
10 : 6 = 1 rem 4
6 : 4 = 1 rem 2
4 : 2 = 2 rem 0
Reason. Let subscript i count the rows. One start with the given numbers as remainders
r0 = a and r1 = b. The i-th row of the scheme is
The algorithm stops when a zero remainder rm+1 = 0 appears for the first time, say in
row m. The last nonzero remainder is rm . We check that rm is the greatest common
divisor. From the identity
gcd(a, b) = gcd(r0 , r1 )
gcd(a, b) = gcd(ri1 , ri ) = gcd(ri , ri+1 ) for all i = 1, 2 . . . m
gcd(a, b) = gcd(rm , rm+1 ) = rm
3
Again, a, b are positive integers. Beyond calculating their greatest common divisor,
the extended Euclidean algorithm yields gcd(a, b) as an integer combination
(*) gcd(a, b) = sa tb
Actually, the convenient smallest solution s, t of equation (*) is calculated by the ex-
tended Euclidean algorithm. Furthermore, (1)m s 0 and (1)m t 0, where m is the
number of steps of the algorithm.
Definition 1.5 (The Extended Euclidean Algorithm). Similar to the common
algorithm, one starts with dividing a by b, followed by successive divisions with re-
mainders. One has to keep track of both the quotients qi and remainders ri . But the
extended algorithm needs two extra columns, which start in row 0 and 1 with the 2 2
unit matrix, whereas the divisions start at row 1 with the calculation of a : b. The
operation to successively produce these two extra columns is
row two above current row plus quotient row one above current row 7
gives current row.
The algorithm stops when a division has zero remainder for the first time. The
greatest common divisor gcd(a, b) is the last nonzero remainder. In the m-th row,
adjacent to the zero remainder rm+1 , appear the numbers sm and tm such that
and hence (*) follows with s = (1)m sm and t = (1)m tm . The optional extra row
m + 1 does not contain a division, only sm+1 and tm+1 are calculated. Because of the
relations
b a
(m+1) sm+1 = , tm+1 =
gcd(a, b) gcd(a, b)
shown in Corollary 1.3 below, we get a convenient check.
Example 1.2. Take a = 42, b = 16.
row 0: 1 0
row 1: 42 : 16 = 2 rem 10 0 1
row 2: 16 : 10 = 1 rem 6 1 2
row 3: 10 : 6 = 1 rem 4 1 3
row 4: 6 : 4 = 1 rem 2 2 5
row m=5: 4 : 2 = 2 rem 0 3 8
row m+1: 8 21
4
The optional extra row m + 1 does no longer involve a division step of the ordinary
Euclidean algorithm. The extra calculation of sm+1 and tm+1 is a convenient check.
sm+1 and tm+1 are calculated. Because of the relations
b a
(m+1) sm+1 = , tm+1 =
gcd(a, b) gcd(a, b)
shown in Corollary 1.3 below, we get a convenient check.
Reason for the extended algorithm. Let subscript i count the rows. Starting with the
given numbers as remainders r0 = a and r1 = b, the i-th row of the extended scheme is
si+1 = si1 + qi si
(1.6)
ti+1 = ti1 + qi ti
(combine) (1)i ri = si a ti b
(1)m rm = sm a tm b
hence formula (*m) holds. The numbers sm , tm show up next to the zero remainder
rm+1 = 0. For odd number m steps s = sm , t = tm are negative, for even m, we get
s = sm , t = tm which are positive.
5
10 Problem 1.2. Express the greatest common divisor gcd(4321, 1234) as integer
combination
(*) gcd(a, b) = sa tb
of these two given integers.
Answer.
row 0: 1 0
row 1: 4231 : 1234 = 3 rem 619 0 1
row 2: 1234 : 619 = 1 rem 615 1 3
row 3: 619 : 615 = 1 rem 4 1 4
(1.8)
row 4: 615 : 4= 153 rem 3 2 7
row 5: 4: 3= 1 rem 1 307 1 075
row m=6: 3: 1= 3 rem 0 309 1 082
row m+1: 1234 4321
Hence gcd(4321, 1234) = 1 and 309 4321 1 082 1234 = 1 = gcd(4321, 1234). We get
s = 309, t = 1 082. These numbers are positive since the number m = 6 of steps of the
algorithm is even.
Remark (Backtracking the old fashioned way ). For completeness I mention the back-
tracking algorithm, which can be used to produce formula (*), too. At first one does
the common Euclidean algorithm, keeping the quotients. But as the price for not plan-
ning ahead, one has to remember the two entire sequences of remainders and quotients.
Going backwards, one uses the divisions of the algorithm in reversed order and calcu-
lates expressions for the greatest common divisor in terms of two successively larger
remainders.
Example 1.3. Get integers s, t such that s42 t16 = gcd(42, 16).
gcd(42, 16) = 2 = 6 4 = 6 (10 6)
= 10 + 2 6 = 10 + 2 [16 10]
= 2 16 3 10 = 2 16 3 [42 2 16]
= 3 42 + 8 16
from which we see one (non unique) solution s = 3, t = 8 of formula (*).
10 Problem 1.3. Use the old fashioned backtracking to express the greatest com-
mon divisor gcd(4321, 1234) as integer combination.
Answer.
gcd(4321, 1234) = 1 = 4 3 = 4 [615 153 4]
= 615 + 154 4 = 615 + 154 [619 615]
= 154 619 155 615 = 154 619 155 [1234 619]
= 155 1234 + 309 619 = 155 1234 + 309 [4321 3 1234]
= 309 4321 1082 1234
6
from which we see one (non unique) solution s = 309, t = 1082. such that s4321
t1234 = gcd(4321, 1234).
(*) gcd(a, b) = sa tb
Reason. It is easy to check that formula (1.9) gives integer solutions of equation (*).
Conversely, suppose that both s, t and s0 , t0 are solutions of (*):
sa tb = gcd(a, b)
s a t0 b = gcd(a, b)
0
Multiplying the first equation above by t0 , the second one by t and subtracting yields
the first equation below, multiplying the first equation by s0 , the second one by s and
subtracting yields the first equation below. Similarly, we get the second one.
Corollary 1.2. The least common multiple of any positive integers a and b is
ab
(1.10) lcm (a, b) =
gcd(a, b)
Proof. We check that the number
ab
(1.11) l :=
gcd(a, b)
on the right hand side satisfies both requirements (a) and (b) from the definition 1.3 of
the least common multiple.
7
b a
(a) The number l is a multiple of both a and b, since l = a gcd(a,b)
= gcd(a,b)
b.
(b) Assume the positive integer k is a multiple of both a and b. We need to check that
k is a multiple of l.
Check of item (b). Since the positive integer k is assumed to be a multiple of both a
and b, there exist integers p and q such that k = aq = bp. The greatest common divisor
satisfies
(*) gcd(a, b) = sa tb
Corollary 1.3. One can take the calculation of the sequences si and ti one step further
up to i = m + 1 and get
b a
(m+1) sm+1 = , tm+1 =
gcd(a, b) gcd(a, b)
8
Reason for Corollary 1.3. We set up a linear system to calculate the extra values sm+1
and tm+1 . To this end we use formula (combine) for i = m + 1, and the determinant
identity (det) with i = m.
tm sm+1 sm tm+1 = (1)m+1
(sys)
a sm+1 b tm+1 = 0
The determinant of system (sys) is
= tm b + sm a = (1)m gcd(a, b) 6= 0
Hence system (sys) has a unique solution, to be obtained by Cramers rule. It turns out
to be (m+1).
Remark. Here is a direct calculation to check (m+1):
b = (1)m+1 [(bsm+1 ) tm sm (btm+1 )] = (1)m+1 [(bsm+1 ) tm sm (asm+1 )]
= (1)m+1 [btm asm ] sm+1 = gcd(a, b) sm+1
9
2 A More Abstract Construction of the Gcd
Definition 2.1 (Integer combination). Any number sa + tb with (positive or nega-
tive) integers s, t Z is called an integer combination of a and b.
Proposition 2.1 (The gcd as integer combination). The greatest common divisor
of any two positive integers a and b is the smallest positive integer combination of a and
b.
x := min{sa + tb > 0 : s, t Z}
(ii) gcd(a, b) | x.
(iii) x | a and x | b
Using (ii) and (iii), it is now easy to show that actually gcd(a, b) = x. Indeed item
(ii) implies gcd(a, b) x. On the other hand, item (iii) implies that x is indeed a
common divisor of a and b, and hence x gcd(a, b). Both inequalities together imply
x = gcd(a, b), as to be shown.
10 Problem 2.1. Give the reason for the three items (i)(ii)(iii).
Reason for item (i). By the assumptions h | a and h | b, there exist integers p and q
such that a = ph and b = qh. Hence
10
with q, r Z and remainder 0 r < x. Hence
which shows that the remainder is an integer combination of a and b. Since r < x and
x is the smallest positive integer combination, we conclude r = 0. Hence x divides a
without remainder, as to be shown.
Proposition 2.2 (Characterization of the gcd via divisibility). Assume that a
and b are not both zero. The greatest common divisor of any such integers a and b, is
the integer g such that
(a) g | a and g | b.
1 = sa + tb
11
Standard proof . By the extended Euclidean algorithm, there exist integers s, t such that
1 = sa + tc
Multiplying both sides by b, and using ab = qc yields
b = sab + tcb = sqc + tcb = (sq + tb)c
Hence c divides b, as to be shown.
Theorem 2.1 (Least common multiple). The least common multiple of two positive
integers a and b is the smallest positive integer that is a multiple of both a and b.
Proof. Let l be the positive integer such that
(a) a | l and b | l.
(b) If a | k and b | k, and k 0, then l k.
10 Problem 2.2. Prove that the two requirements (a) and (b) determine the
natural number l uniquely.
Replace k in requirement (b) by the
ab
l :=
gcd(a, b)
Since the condition imposed inside (b) does hold, we conclude that
ll
The requirement (b) is weaker than the divisibility requirement (b) which we have
imposed in the original definition 1.3and checked to hold for l.
Next we put
k := gcd(l, ab)
into requirement (b). Since the condition imposed inside (b) does hold, we conclude
that
l gcd(l, ab)
Hence l is a divisor of ab, and
ab
q :=
l
is an integer. Since q is a divisor of both a and b, we see that q is a divisor of gcd(a, b).
Hence
ab
q= gcd(a, b)
l
ab
l= l
gcd(a, b)
12
Since we have already shown l l, we conclude l = l.
We have shown in corollary 1.2 above that l is the least common multiple, according
to the original definition 1.3. Since l = l, both definitions of the least common multiple
are equivalentusing either requirement (b) or requirement (b).
10 Problem 3.1. Let the distance from the capital to the battle site be x li.
Assume the messengers P,Q and R ran p, q and r entire days plus a few hours more.
How many miles did each of the messengers cover during the his last extra hours, beyond
the many entire days he kept running? Set up the equations relating x, p, q, r and a
system of three simultaneous congruences for x.
Answer. The messengers ran 12, 9 and 3 more hours than entire days. In these extra
hours they could cover 150, 90 and 30 li, respectively. Hence
13
Theorem 3.1 (Chinese Remainder Theorem). Simultaneous congruences
x u mod a
(ch)
x v mod b
have either a solution determined uniquely modulo the least common multiple, or no
solution. They are solvable if and only if the difference u v is divisible by gcd(a, b).
Necessary for solvability is that gcd(a, b) divides u v. Suppose that the system (ch)
has the solution x. The two congruences imply that both x u and x v are di-
visible by the greatest common multiple gcd(a, b). Hence their difference needs to be
divisible by u v.
The solution is only defined modulo the least common multiple. Let x be a solution of
the system (ch). Then for any integer , the number x + lcm (a, b) is a solution
of (ch), too.
The solution is unique modulo the least common multiple. Suppose the system of simul-
taneous congruences (ch) has two solutions x and x0 . In that situation, both numbers
a and b are divisors of the difference x x0 . In other words, the difference x x0 is a
multiple of both numbers a and b, and hence x x0 is a multiple of the least common
multiple lcm (a, b). In other words
Now I give a rather effective solution of the simultaneous congruences (ch), good for
hand calculations. From that algorithm, it is clear that the greatest common divisor
dividing u v is a sufficient condition for solvability of (ch). After an example, the
justification is elaborated to yield some useful general formulas. Finally a ruthlessly
optimized solution suitable to be programmed on TI 85 is presented.
14
10 Problem 3.3. Find the least common multiple lcm (99, 6).
Answer.
20 7
lcm (99, 6) = = 198
gcd(99, 6)
It is now easy to solve the given simultaneous congruences.
x4 mod 99
x4 mod 6
Why is this particularly easy?
Answer. The remainder is the same in both congruences. They simply tell that x 4 is
divisible by both 99 and 6. Hence x 4 is divisible by the least common multiple 198.
In other words
x 4 mod 198
(c) In the next step we decide existence or nonexistence of a solution of (ch). To this
end we calculate
vu
(d) d :=
gcd(a, b)
If d turns out not to be an integer, the greatest common divisor gcd(a, b) does
not divide the difference u v, and the simultaneous congruences (ch) have no
solution. If d is an integer, we go on to get the solution of (ch).
15
(d) We convert the given simultaneous congruences (ch) into an equivalent system
x u + pa mod a
(ch)
x v + qb mod b
with equal right-hand sides u + pa = v + qb. To determine p and q, we multiply
both sides of formula (*) by d. Next one puts u and a on the left hand, but v and
b on the right hand side.
w := u + pa = v + qb
Better check whether both sides of equation (wequal) are equal. One needs to get
w = w : both sides are equal! The number w is a solution of the system (ch).
Indeed, this system is equivalent to the equations
x u + pa mod a
(ch)
x v + qb mod b
which have two equal right-hand sides w := u + pa = v + qb. We get the solution
(f ) The solution is only determined modulo the least common multiple of a and b, which
we get via the formula
ab
(1.10) lcm (a, b) =
gcd(a, b)
(g) Finally, one wants to state the result in terms of the reduced remainder
16
It is uniquely determined modulo the least common multiple lcm (a, b).
x1 mod 42
(chexample)
x3 mod 16
Example 3.1 (Direct hand solution). Do the extended Euclidean algorithm, keeping
the quotients and two extension columns.
1 0
42 : 16 = 2 rem 10 0 1
16 : 10 = 1 rem 6 1 2
10 : 6 = 1 rem 4 1 3
6 : 4 = 1 rem 2 2 5
2 : 1 = 2 rem 0 3 8
8 21
(*) (3) 42 + 8 16 = 2
Because this turns out to be an integer, the simultaneous congruences (chexample) are
solvable.
(d) The key step to calculate the solution is to multiply both sides of formula (*) by
d = 1. This is really easy!
We then put u, and the multiple of a on the left-hand side. But v, and the multiple of b
from the second equation on the right-hand side. At this point, it is important to keep
the factors 42 and 16 separate, therefore I have underlined those two given numbers.
(wequal) 1 3 42 = 3 8 16
165 = 165
17
(e) Both sides of the last line are equal to the same number 165, which is a solution
of (chexample). Better check that both sides are equal!
(f ) The least common multiple is
42 16
lcm (42, 16) = = 336
2
(g) Finally, because the solution of (chexample) is only uniquely determined modulo
the least common multiple 336, one wants to state it in terms of the reduced remainder
which is uniquely specified by
10 Problem 3.5 (The battle problem). Solve the simultaneous congruences and
the equation x = 150 + 300p = 90 + 240q = 30 + 180r. How far away from the capital
was the battle site? We assume that China is so small that only the smallest positive
solution can be right. How many entire days did each of the messengers run?
10 Problem 3.6. Begin by solving the first two congruences
18
(a) The greatest common divisor is gcd(300, 240) = 60.
(b) With s = 1, t = 1, the greatest common divisor is the integer combination
(*) 1 300 1 240 = 60
(e) Both sides of the last line are equal to the same number 150, which is a solution
of (PQ). Better check that both sides are equal!
(f ) The least common multiple is
300 240
lcm (300, 240) = = 1200
60
(g) Finally, because the solution of (PQ) is only uniquely determined modulo the least
common multiple 1200, one wants state it in terms of the reduced remainder
(w) w w mod 1200 and 0 w < 1200
which is w = 150 + 1200 = 1050. The solution of the simultaneous congruences
(ch2) is now
x 1050 mod 1200
10 Problem 3.7. To solve all three simultaneous congruences, we combine the
solution of the first two with the third one. Solve the resulting two congruences
x 1050 mod 1200
([PQ]R)
x 30 mod 180
19
Answer. The extended Euclidean algorithm:
1 0
1200 : 180 = 6 rem 120 0 1
180 : 120 = 1 rem 60 1 6
120 : 60 = 2 rem 0 1 7
3 20
Because this turns out to be an integer, the simultaneous congruences ([PQ]R) are
solvable.
d) The key step to calculate the solution is to multiply both sides of formula (*) by
d = 17.
Keep the factors 1200 and 180 separate, therefore they are underlined. Next one
puts u = 1050 and 1200 on the left hand, but v = 30 and 180 on the right hand
side.
(e) Both sides of the last line are equal to the same number 21 450, which is a solution
of ([PQ]R). Better check that both sides are equal!
20
(g) Finally, because the solution of ([PQ]R) is only uniquely determined modulo the
least common multiple 3600, one wants state it in terms of the reduced remainder
10 Problem 3.8. Complete the solution of the battle problem. How far away
from the capital was the battle site? We assume that China is so small that only the
smallest positive solution can be right. How many entire days did each of the messengers
run?
Answer. x = 3 450 is the smallest positive solution, which is the distance from the battle
field to the capital. This value for x yields p, q and r, too.
3 450 150
Messenger P ran p = = 11 entire days and 12 hours.
300
3 450 90
Messenger Q ran q = = 14 entire days and 9 hours.
240
3 450 30
Messenger R ran r = = 19 entire days and 4 hours.
180
The battle was won 19 days before the arrival of the last messenger.
with s, t satisfying
(*) gcd(a, b) = sa tb
21
Remark. If equation (ch) is solvable, these formulas give the solution. Different choices
of s, t lead to the same solution modulo the least common multiple lcm (a, b). But in
the case that equation (ch) is not solvable, these formulas give wrong integral values,
which still depend on the particular choice of s, t.
Reason. By definition, the system (ch) means that there exist integers p and q such that
x u + pa mod a
(ch)
x v + qb mod b
(3.2) u v = pa + qb
(*) gcd(a, b) = sa tb
from the extended Euclidean algorithm. One needs to multiply both sides of the latter
equation (*) by the integer
uv
d =
gcd(a, b)
and get a non-unique solution of equation (3.2):
vu vu
p = ds = s , q = dt = t
gcd(a, b) gcd(a, b)
Plugging this result into equation (ch) yields alternatively to the two expressions (chs)
and (cht). As already clear from (ch) above, both have to turn out to be the same result.
Putting the fractions on a common denominators yields both times formula (chresult).
10 Problem 3.9. Check that both expressions (chs) and (cht) are equal to (chresult).
Answer.
vu u gcd(a, b) + sa(v u)
u + sa =
gcd(a, b) gcd(a, b)
u(sa tb) + sa(v u)
=
gcd(a, b)
sva tub
=
gcd(a, b)
22
A similar calculation starts with the second expression
vu v gcd(a, b) + tb(v u)
v + tb =
gcd(a, b) gcd(a, b)
v(sa tb) + tb(v u)
=
gcd(a, b)
sva tub
=
gcd(a, b)
and yields indeed the same result.
10 Problem 3.10. Solve the battle problem combining the congruences in the
order QR and then [QR] P. Solve the battle problem combining the congruences in the
order PR and then [PR] Q.
23
is a bijection which yields the solution of the Chinese remainder problem (ch). Its
inverse x 7 f 1 (x) = (u, v) is obtained by reducing x Zab to the remainders u Za
and v Zb .
Let U(Zm ) be the group of units in the ring Zm . Clearly, this group can be repre-
sented by the congruence classes (a mod m) for which gcd(a, m) = 1 holds. Hence the
order of this group
| U(Zm ) | = (m)
is the Euler totient function.
Moreover, consider for the Chinese remainder problem problem (ch) the case that
gcd(u, a) = gcd(v, b) = 1, and gcd(a, b) = 1 as was assumed before. Under these
assumptions, gcd(f (u, v), ab) = 1 holds for the solution of problem (ch). The converse
is true, too: gcd(f (u, v), ab) = 1 implies gcd(u, a) = gcd(v, b) = 1. Hence we get an
interesting result about the structure of the group U(Zab ):
Corollary 3.1. For any relatively prime a and b we have a group isomorphism, and
hence the Euler totient function is multiplicative.
U(Za ) U(Zb ) ' U(Zab )
(ab) = (a)(b)
24
The solution of the simultaneous congruence modulo the least common multiple, with
reduced remainder is
10 Problem 3.11. Following the procedure above, solve the simultaneous con-
gruences
(3.10) x1 mod 42
(3.11) x3 mod 16
Get a congruence modulo the least common multiple, with reduced remainder.
Express solution. Do the extended Euclidean algorithm, keep the quotients, use one
extension column, with alternating signs.
42 : 16 = 2 rem 10 0
16 : 10 = 1 rem 6 1
10 : 6 = 1 rem 4 1
(3.12)
6 : 4 = 1 rem 2 2
2 : 1 = 2 rem 0 3
8
One gets gcd(42, 16) = 2 and s = 3. (It is easy to check that t = 8, but we do not
need it.) Are the congruences solvable? To check calculate
uv 13
(3.13) d := = = 1
gcd(a, b) 2
Result
25
Definition 3.1 (Program for the TI84). Three successive remainders ri are
X,Y,Z
Three successive terms si are
R,S,G
In the end, one should have
rM = Y , sM = S, sM +1 = G.
Prompt A,B
Lbl 0
Prompt U,V
A -> Y: B -> Z
1 -> S: 0 -> G: 0 -> M
Lbl 1
If Z = 0:Goto 2
Y -> X: Z -> Y
S -> R: G -> S
int(X/Y) -> Q
X-QY -> Z: R-QS -> G: M+1 -> M
Goto 1
Lbl 2
Disp{Y,M}
B/Y -> H: AH -> L
(U-V)/Y -> D
DS -> P
P-int(P/H)H -> P
U-PA -> W
W-int(W/L)L -> W
Lbl 3
{D,W-U-int((W-U)/A)A,W-V-int((W-V)/B)B} -> L_1
Disp L_1
Disp {W,L}
The output of the program consists of these three lists:
{Y,M}
{D,W-U-int((W-U)/A)A,W-V-int((W-V)/B)B}
if and only if the congruences are solvable, and two check numbers that are 0, 0 if
and only if the congruences solved correctly;
{W,L}
10 Problem 3.12. Check the solution of the battle problem with the program
above.
26
4 The Postage Problem
Stamps are available only in two denominations of integer values a and b. For which
values can a letter get the postage value N by using only these two denominations?
This problem leads to the equation
(1) N = xa + yb
(1) N = xa + yb
for all integers N positive or negative. Now we can use the extended Euclidean algorithm
to get all solutions:
Answer.
(pm) x = N s + b , y = N t a
with arbitrary integer and s, t such that 1 = sa bt, as stated in the extended
Euclidean algorithm.
The postage problem requires a solution of equation (1) with the additional restric-
tions x 0 and y 0. The possible choices of the number x are an arithmetic sequence
with difference b. To increase y, one wants to chose x 0 as small as possible. In that
case 0 x b 1. Once x in that interval is fixed, formula (1) determines the integer
y uniquely. The question is whether y come out as nonnegative or negative. (Similarly,
we could choose y in the interval 0 y a 1, and then check whether x comes out
as nonnegative.)
Now we give the reason for (i). Supposing (1) cannot be solved with x 0 and
y 0, we show that N < (a 1)(b 1).
Assume that equation (1) cannot be solved with x 0 and y 0. As explained
above, one can still solve (1) with x or y a negative integer. Furthermore, we can assume
0 x b 1 by fixing the choice of x in the arithmetic sequence of difference b.
27
Since equation (1) cannot be solved with x 0 and y 0, this reasoning needs to
lead to a solution of (1) with 0 x b 1 and y < 0. But these two inequalities imply
N = xa + yb (b 1)a b = (a 1)(b 1) 1
Thus nonexistence of a solution of the postage problem implies N < (a1)(b1). Hence,
the contrapositive statement confirms item (i): If N (a 1)(b 1), equation (1) can
be solved with x 0 and y 0.
Next we confirm item (ii). Suppose that 0 N ab a b, and (1) can still be
solved with x 0 and y 0. We define
(2) x0 = 1 x , y 0 = a 1 y , N 0 = ab a b N
Because of x0 < 0, y 0 < a and x0 + b < b, y 0 a < 0, we see that the integer N 0 is not
an nonnegative integer combination of a and b. Hence the postage value N 0 cannot be
done.
The converse holds, too: If the postage value 0 N 0 ab a b cannot be done,
then the postage value N = ab a b N 0 can be done.
Indeed, assuming that value N 0 cannot be posted means that (2) holds with x0 <
0
0, y < a. With x, y and N from relations (2), we get N = xa + by with x 0 and y 0.
Hence the postage value N = ab a b N 0 can be done.
10 Problem 4.1. Find all values N that cannot be posted with just the two
denominations a = 7, b = 3. How many are there? Use the postage proposition to
conform that you got all cases.
Answer. The six values 1, 2, 4, 5, 8, 11 cannot be posted with these two denominations.
Because (a1)(b1)
2
= 6, the postage proposition tells we got all cases that cannot be
posted.
10 Problem 4.2. Check once more directly that the value N = (a 1)(b 1) 1
cannot be posted.
(a 1)(b 1) 1 = (b 1) a 1 b
(a 1)(b 1) 1 = 1 a + (a 1) b
28
10 Problem 4.3. Do the postage 140 with denominations 21 and 8.
Answer. Use 1 = sa tb from the extended Euclidean algorithm, multiple by 140, and
adjust to a nonnegative solution. This happens with = 53 in formula (pm).
1 = (3) 21 + 8 8
140 = (480) 21 + 1120 8
140 = (480 + 8) 21 + (8 21) 8
140 = (480 + 53 8) 21 + (8 53 21) 8
140 = 4 21 + 7 8
10 Problem 4.4. For any a and b relatively prime, use 1 = sa tb from the
extended Euclidean algorithm to determine x and y in (1) needed to do the postage
(a 1)(b 1).
Answer.
(a 1)(b 1) = ab a b + 1 = (b 1)a b + sa tb
(odd) = (b 1 + s)a + (t 1)b
(even) = (s 1)a + (a 1 t)b
The solution (odd) turns out to be nonnegative for an odd number m of steps in the
Euclidean algorithm. Because of |s| 2b and t < 0, we get x = b 1 + s 0 and
y = t 1 0.
The solution (even) yields x = s 1, y = a + t 1. Because of s > 0 and |t| a2 , this
alternative gets nonnegative for an even number m of steps in the Euclidean algorithm.
F0 = 0, F1 = 1, F2 = 1, F3 = 2, F4 = 3, F5 = 5, F6 = 8, . . .
Fi+1 = Fi + Fi1 for all i 1
29
(a) m = 6, q = 2 and
(b) m = 6, q = 0.
Answer. (a) m = 6, q = 2
row 0: 1 0
row 1: 47 : 13 = 3 rem 8 0 1
row 2: 13 : 8 = 1 rem 5 1 3
row 3: 8: 5= 1 rem 3 1 4
(5.1)
row 4: 5: 3= 1 rem 2 2 7
row 5: 3: 2= 1 rem 1 3 11
row m=6: 2: 1= 2 rem 0 5 18
row m+1: 13 47
row 0: 1 0
row 1: 8 : 29 = 0 rem 8 0 1
row 2: 29 : 8 = 3 rem 5 1 0
row 3: 8: 5= 1 rem 3 3 1
(5.2)
row 4: 5: 3= 1 rem 2 4 1
row 5: 3: 2= 1 rem 1 7 2
row m=6: 2: 1= 2 rem 0 11 3
row m+1: 29 8
(b) m = 6, q = 0
row 0: 1 0
row 1: 21 : 13 = 1 rem 8 0 1
row 2: 13 : 8 = 1 rem 5 1 1
row 3: 8: 5= 1 rem 3 1 2
(5.3)
row 4: 5: 3= 1 rem 2 2 3
row 5: 3: 2= 1 rem 1 3 5
row m=6: 2: 1= 2 rem 0 5 8
row m+1: 13 21
row 0: 1 0
row 1: 8 : 13 = 0 rem 8 0 1
row 2: 13 : 8 = 1 rem 5 1 0
row 3: 8: 5= 1 rem 3 1 1
(5.4)
row 4: 5: 3= 1 rem 2 2 1
row 5: 3: 2= 1 rem 1 3 2
row m=6: 2: 1= 2 rem 0 5 3
row m+1: 13 8
30
Reason for proposition 5.1. For example (1), the Euclidean algorithm consists of these
m steps:
row 1: a: b= q + 1 rem Fm
row 2: b: Fm = 1 rem Fm1
row 3: Fm : Fm1 = 1 rem Fm2
(5.5)
row i: Fm+3i : Fm+2i = 1 rem Fm+1i
row m-1: F4 : F3 = 1 rem 1
row m: F3 : F2 = 2 rem 0
For example (2), only the two first steps are different. Here are all m steps:
row 1: a: b= 0 rem Fm
row 2: b: Fm = q + 1 rem Fm1
row 3: Fm : Fm1 = 1 rem Fm2
(5.6)
row i: Fm+3i : Fm+2i = 1 rem Fm+1i
row m-1: F4 : F3 = 1 rem 1
row m: F3 : F2 = 2 rem 0
Proposition 5.2. Let a and b be positive integers. If the Euclidean algorithm needs m
steps, then
Proof. The claim is obvious for m = 1.In this case, b divides a and b = gcd(a, b).
Suppose the Euclidean algorithm needs m 2 steps. Hence the last quotient qm 2.
Following the remainders backwards yields
rm = gcd(a, b) = gcd(a, b) F2
rm1 2rm = gcd(a, b) F3
rm2 rm + rm1 gcd(a, b) F4
For i = 2, we get the first claim b gcd(a, b) Fm+1 . If a > b, we know that q1 1, and
hence i = 1 can be included in the estimate (rup). Thus one confirms the second claim
a gcd(a, b) Fm+2 .
31
Proposition 5.3. Let a and b be positive integers. If
Hence m = n, b = Fm+1 , and gcd(a, b) = 1. Equality holds for the entire sequence
of estimates (rup) and hence qi = 1 for i = 2 . . . m 1 and qm = 2. One gets r2 =
gcd(a, b) Fm = Fm , hence a = q1 b + r2 = q1 Fm+1 + Fm = (q1 1)Fm+1 + Fm+2 . In
case that q1 1, we get example (1). Or, as an exceptional case q1 = 0, we conclude
a = r2 = Fm and b = Fm+1 , which is example (2) with q = 0.
If a F2 = 1 and n = 2, then m 2 is obvious. Secondly, suppose that a Fn
and m n 3. Distinguish the cases (a):a b and (b):a < b. Case (a) cannot occur,
because gcd(a, b)Fm+2 a Fn Fm leads to a contradiction.
In case (b), the first quotient is zero and first three remainders are r0 = a, r1 = b, r2 =
a. After discarting the first step, we get a Euclidean algorithm with m 1 n 1 2
steps, for which the first entry is now b and second entry is a Fn . As explained above,
one concludes
(5.10) Fm gcd(b, a) Fm a Fn Fm
10 Problem 5.2. Calculate the Fibonacci numbers and check the inversion for-
mula (Fibinverse) for n 12.
32
Theorem 5.1 (Logarithmic effectiveness of the Euclidean Algorithm). The
number of steps m(a, b) the Euclidean algorithm takes is bounded above by
(5.12)
log a log 2 log gcd(a, b) log b log 2 log gcd(a, b)
m(a, b) min +3 , +2
log log
Proof. Independent verification We may assume a 6= b since the case a = b is obvious.
Because of qi 1 for 2 i m and even qm 2, equation (1.6) implies inductively
si Fi1 for i = 1, 2 . . . m. Corollary 1.3 implies now
b
(5.13) = sm+1 2sm + sm1 2Fm1 + Fm2 = Fm+1
gcd(a, b)
with m = m(a, b). Hence the inversion formula (Fibinverse) implies
log Fm+1 log 2 log b log 2 log gcd(a, b)
(5.14) m(a, b) + 1 = +3 +3
log log
To get an estimate of m(a, b) in terms of a, we distinguish the cases
(a): a < b
(b): a > b
(c): a = b
In case (a), the algorithm starts with the remainders a, b, a. Discarting the first step
yields
log a log 2 log gcd(a, b)
(5.15) m(a, b) 1 = m(b, a) +2
log
as claimed. In case (b), we consider the prolonged algorithm starting with the remainders
a + b, a, b from which one gets
log a log 2 log gcd(a, b)
(5.16) m(a, b) = m(a + b, a) 1 +1
log
which yields an estimate of m(a, b) betterby twothan the one claimed.
33
Proof. The proof is done by induction: The start at i = 1, 2 is s1 = 0, s2 = 1, and
t1 = 0, t2 = q1 0, is obvious, as is the induction step.
10 Problem 6.1. Use the extended algorithm for gcd(4321, 1234) from prob-
lem 4, to get another instance of the Euclidean algorithm from the reversed sequence
sm+1 , sm , sm1 , . . . . Use extended mode, and check what happens at the very last steps.
Answer. The reversed sequences sm+1 , sm , sm1 , . . . occurs in the Euclidean algorithm
row 0: 1 0
row 1: 1234 : 309 = 3 rem 307 0 1
row 2: 309 : 307 = 1 rem 2 1 3
(6.1)
row 3: 307 : 2 = 153 rem 1 1 4
row m=4: 2: 1= 2 rem 0 154 615
row m+1: 309 1234
10 Problem 6.2. Use the extended algorithm for gcd(4321, 1234) from prob-
lem 1.2, to get another instance of the Euclidean algorithm from the reversed sequence
tm+1 , tm , tm1 , . . . . Use extended mode, and check what happens at the very last steps.
Answer. The reversed sequences tm+1 , tm , tm1 , . . . occurs in the Euclidean algorithm
row 0: 1 0
row 1: 4321 : 1082 = 3 rem 1075 0 1
row 2: 1082 : 1075 = 1 rem 7 1 3
row 3: 1075 : 7= 153 rem 4 1 4
(6.2)
row 4: 7: 4= 1 rem 3 154 615
row 5: 4: 3= 1 rem 1 155 619
row m=6: 3: 1= 3 rem 0 309 1234
row m+1: 1082 4321
10 Problem 6.3. There are only three cases in which two consecutive equal terms
in the sequences si 0 for i = 1, 2 . . . m + 1, or ti 0 for i = 2, 3 . . . m + 1. Find these
cases and give examples containing them.
Answer. 1. s2 = s3 = 1 occurs in case that q2 = 1.
2. t1 = t2 = 1 occurs in case that q1 = 1.
3. t3 = t4 = 1 occurs in case that q1 = 0, q3 = 1.
Proposition 6.2 (Reversing the Euclidean Algorithm). Assume a > 2b. The
reversed second extension column tm+1 , tm , tm1 , . . . gives another instance of the Eu-
clidean algorithm which has remainders and quotients
rei = tm+1i for i = 0, 1, 2 . . . m + 1
(6.3)
qei = qm+1i for i = 1, 2 . . . m
34
The extension column of the newly constructed algorithm
rm+1i
(6.4) tei =
gcd(a, b)
is proportional to the original remainders reversed.
Problems 1.2 and 6.2 give an example for two mutually reversed algorithms.
7 Descartes Problem
Given is an integer A 2. In how many ways can one write A as a sum of two squares
Take for example A = 125. There are two solutions: 125 = 102 + 52 = 112 + 22 . For
A = 25, we get the two solutions 25 = 52 + 02 = 42 + 32 .
Definition 7.1 (Descartes restricted sum of squares problem). Given is an
integer A 3. How many solutions are there for
For A = 125, there is just one solution 125 = 112 + 22 . In this essay, I want to
concentrate on the restricted problem. The Euclidean algorithm helps to establish the
following result:
Theorem 7.1 (Counting the solutions of the restricted problem). We fix a value
A 3 for the sum. There exists a bijection between the solutions of the restricted sum
of squares problem and the solutions of the congruence
A
(imag) 1 + J2 0 mod A and 1J <
2
Hence both problems have the same number of solutions.
This theorem is useful for the practical calculation of the solution of Descartes
problem for a given very large number A, too. Indeed, a solution J of system (imag)
can be found much quicker than a direct solution of Descartes problem is possible.
Reason. Let p 1 mod 4 be a prime number, and r a primitive root. Eulers theorem
implies
p1
r 2 1 mod p
p1
and hence one of J := r 4 mod p yields a solution of (imag). Thus the congru-
ence (imag) can be solved much faster than Descartes problem, which can afterwards
be solved by the method elaborated below.
35
By proposition 7.8 and proposition 7.9 below, one needs just half of a simple Eu-
clidean algorithm starting with A and J, to effectively calculate a solution of Descartes
restricted problem. Furthermore, by theorem 7.1 above, starting from a complete list
of solutions of congruence (imag) leads to a complete list of solutions of Descartes
restricted problem.
To construct the bijection J (a, b), we begin with a remark linking the extended
Euclidean algorithm to complex arithmetic. Besides calculating the greatest common
divisor, the extended Euclidean algorithm expresses it as an integer combination
(*m) (1)m gcd(a, b) = sm a tm b
Using complex Gaussian integers and the imaginary unit j 2 = 1 one rewrites this
equation and its absolute square as
(sm + tm j) (a + bj) = (1)m gcd(a, b) + Jj
(***)
(s2 + t2 ) (a2 + b2 ) = gcd(a, b)2 + J 2
Again m(a, b) is the number of steps of the Euclidean algorithm, and J 1 is defined
as
(7.1) J := sm b + tm a
Proposition 7.1 (Mapping (a, b) 7 J). Assume that a > b and gcd(a, b) = 1. The
congruence
a2 + b 2
(imag) 1 + J2 0 mod a2 + b2 and 1J <
2
has the solution J = sm b + tm a. Furthermore, in the ring of Gaussian integers, either
1 + Jj or 1 Jj is a multiple of a + bj, depending on whether the number m(a, b) of
steps of the algorithm is even or odd.
Proof. Because of the squared formula in (***), the value J from formula (7.1) is a
solution of (imag). Furthermore since a 6= b is assumed,
b a
(**) |sm | and |tm |
2 gcd(a, b) 2 gcd(a, b)
as has been shown in corollary 1.4. This estimate implies
a2 + b 2
1J
2 gcd(a, b)
We can exclude the maximal value since
(a2 + b2 )2
gcd(a, b)2 + J 2 = (s2 + t2 ) (a2 + b2 )
4 gcd(a, b)2
1
1 a2 +b2
Actually the maximal value J = 2 gcd(a,b) occurs if and only if a = b.
36
To construct the inverse mapping J 7 (a, b), we need to carefully investigate the
Euclidean algorithm starting with a2 + b2 and J.
Definition 7.2. I call a Euclidean algorithm self-symmetric if and only if
ti+1 = ti1 + qi ti
rmi = rm+2i + qm+1i rm+1i = rm+2i + qi rm+1i
37
ti+1 are relatively prime for i = 0, 1 . . . m. Corollary 1.3 and formula (str) for i = m
imply
b r1
sm+1 = = = tm
gcd(a, b) gcd(a, b)
and the other formula of (sm+1), too. The determinant identity
The determinant identity sm tm+1 sm+1 tm = (1)m , again from proposition 1.1, and
formula (sm+1) imply (sm).
Proposition 7.3 (Properties of the even self-symmetric algorithm). Assume that the
number of steps m = 2h of a self-symmetric algorithm is even. Then
rh+1 rh
th = and th+1 =
gcd(a, b) gcd(a, b)
a
(qh) t2h+1 + t2h =
gcd(a, b)
2 2
(qm) gcd(a, b) + b 0 mod a gcd(a, b)
m
Proof. We use formula (prod) with i = h = 2
= m i to get formula (qh). Since m is
even, formula (sm) implies
Proposition 7.4. We take the first two remainders to be A and some J < A such
that gcd(A, J) = 1. Assume the resulting Euclidean algorithm is self-symmetric and the
number of steps M (A, J) is even. In this case
A
(imag) 1 + J2 0 mod A and 1J <
2
Proposition 7.4 follows from (qm). More astonishingly, the converse holds, too:
38
Proof. The congruence (imag) implies 1 + J 2 = pA and hence gcd(A, J) = 1.
We now check how the two extension columns Si and Ti of the Euclidean algorithm
starting with R0 = A, R1 = J end. Corollary 1.3 yields
(M+1) SM +1 = J , TM +1 = A
Since gcd(A, J) = 1, formulas (*) and (**) and Corollary 1.4 imply
SM A TM J = (1)M
(7.3) J A
0 < SM and and 0 < TM
2 2
Furthermore, these properties determine SM and TM uniquely.
The assumption J < A2 implies pA = 1 + J 2 < 1 + J2 A and hence 1 p < J2 . Since
pA J 2 = 1, we get as solution of system (7.3):
SM = (1)M p , TM = (1)M J
R
fi = TM +1i for i = 0, 1, 2 . . . M + 1
starts with
R
f0 = TM +1 = A = R0
R
f1 = TM = J = R1
These happen to be just the first two remainders! Because the two initial remainders
determine the Euclidean algorithm uniquely, we conclude that
R
fi = TM +1i = Ri for i = 0, 1, 2 . . . M + 1
(sym)
Q
fi = QM +1i = Qi for i = 1, 2 . . . M
confirming that the algorithm is self-symmetric and has an even number of steps.
Proposition 7.6. Assume A > J, and gcd(A, J) = 1. The Euclidean algorithm is
self-symmetric and the number of steps M (A, J) is even, if and only if
A
(imag) 1 + J2 0 mod A and 1J <
2
Proposition 7.7. Assume a > 2b 1, and gcd(a, b) = 1. If the Euclidean algorithm is
self-symmetric and the number of steps M (a, b) is odd, then 1 + b2 is not divisible by a.
2
2
The exceptions for a = 2, b = 1 has already been excluded.
39
We can now construct the inverse mapping J 7 (a, b) going from a solution of
congruence (imag) to a solution of Descartes restricted problem.
Proposition 7.8 (Mapping (J 7 (a, b)). Assume congruence (imag) holds. Then
A and J are the first two remainders of an even self-symmetric Euclidean algorithm.
Furthermore, the two remainders Rh and Rh+1 with h = M2 just halfway through the
algorithmyield a solution of Descartes restricted problem
2
A = Rh+1 + Rh2 , Rh+1 > Rh 1 and gcd(Rh+1 , Rh ) = 1
Proposition 7.8 follows from (qh). This proposition is useful for the practical cal-
culation of a solution of Descartes problem for a given very large number A, because
indeed, a solution J of system (imag) can be found much quicker than a solution of
Descartes problem.
In this setting, one needs only to calculate half of simple Euclidean algorithm start-
ing with A and J, since it is easy determine when step h + 1 has been reached:
Proposition 7.9. For the Euclidean algorithm of proposition 7.8, the remainder Rh is
the first remainder the square of which is less than A.
Proof.
We need still to check that the mapping : (a, b) 7 J given by proposition 7.1 has
the mapping : J 7 (a, b) from proposition 7.8 as its inverse.
40
parallel to the second of equations (1.6). From the reversed sequence
we get the first half of the sequence of remainders for the doubled Euclidean algorithm,
which turns out to be even and self-symmetric.
Furthermore, this doubled algorithm contains Rm = e a, Rm+1 = eb as two successive
M
remainders occurring in the middle at step m = 2 . It is clear that the remainders
following afterwards for i > M2 agree with those already calculated, hence
We now combine the formulas for the remainders after and before the middle index m.
Using complex Gaussian integers with imaginary unit j 2 = 1, one gets
for i = 0, 1, 2 . . . m + 1.
With i = m and J := R1 = smeb + tme
a, one confirms
a + ebj) = (1)m + R1 j
(sm + tm j) (e
(***)
(s2 + t2 ) (e
a2 + eb2 ) = 1 + R12
aj) (e
(eb + e a + ebj)
(1)m+1 R2m+1 + R0 j = (sm+1 + tm+1 j) (e
a + ebj) = a2 + eb2
=e
gcd(ea, b)
e
The doubled Euclidean algorithmstarting with remainders T2m+1 and T2m has the
sequence of remainders containing
R0 = T2m+1 = a2 + eb2
e
R1 = T2m = smeb + tme a, . . .
Rm = Tm+1 = a,
(7.5)
e
Rm+1 = Tm = eb, . . .
m
R2m = T1 = (1) [sme a tmeb] = 1,
R2m+1 = T0 = 0
41
Example 7.1. At first, one calculates the second half of the algorithm, starting with
the division 10 : 7. The three extension columns contain si ti and Tm+i = si b + ti a.
This third extension contains b, a is the middle. It can be completed forwards using the
iteration (sT), parallel to (st). It is easily completed backwards, because by construction,
the doubled algorithm is self symmetric.
(a) a = 10, b = 7
(1)3 gcd(10, 7) = 1 = 2 10 3 7
(b) a = 5, b = 4
gcd(5, 4) = 1 = 1 5 1 4
(1 + j) (5 + 4j) = 1 + 9j
(***)
(1 + 12 ) (52 + 42 ) = 1 + 92 0
2
mod 41
42
Proposition 7.11. The mapping : (a, b) 7 J from proposition 7.1:
A := a2 + b2 and J := sm b + tm a
has the mapping : J 7 (a, b) from proposition 7.8 as its inverse. In the Euclidean
algorithm starting with A and J, the two numbers (a, b) are the two remainders appearing
in the middle of the algorithm as a = Rh and b = Rh+1 at step h = M2 .
Theorem 7.2 (Correspondence of solutions for Descartes restricted problem
and the congruence for the imaginary unit). Assume A 3. There is a bijective
correspondence between
a > eb 1 of Descartes restricted problem
(a) solutions e
(b) even self symmetric Euclidean algorithm with the two middle remainders Rm = e
a
M
and Rm+1 = b for m = 2 .
e
(c1) a = 24, b = 23
row : 1105 : 47 = 23 rem 1 (1)
row : 47 : 24 = 1 rem 23 23
(7.8)
row i=1: 24 : 23 = 1 rem 1 0 1 24
row m=2: 23 : 1 = 23 rem 0 1 1 47
row m+1: 23 24 1105
43
The doubled self-symmetric algorithm starts with the division 1105 : 47. The second
half of the algorithm starts with the division 24 : 23. We get the integer combination
gcd(24, 23) = 1 = 1 24 1 23
and the Gaussian product
(1 + j) (24 + 23j) = 1 + 47j
(***)
(1 + 12 ) (242 + 232 ) = 1 + 472 0
2
mod 1105
(c2) a = 32, b = 9
row : 1105 : 242 = 4 rem 137 (1)
row : 242 : 137 = 1 rem 105 (4)
row : 137 : 105 = 1 rem 32 (5)
row : 105 : 32 = 3 rem 9 9
(7.9)
row i=1: 32 : 9= 3 rem 5 0 1 32
row i=2: 9: 5= 1 rem 4 1 3 105
row i=3: 5: 4= 1 rem 1 1 4 137
row m=4: 4: 1= 4 rem 0 2 7 242
row m+1: 9 32 1105
The doubled self-symmetric algorithm starts with the division 1105 : 242. The second
half of the algorithm starts with the division 32 : 9. We get the integer combination
gcd(32, 9) = 1 = 2 32 7 9
and the Gaussian product
(2 + 7j) (32 + 9j) = 1 + 242j
(***)
(22 + 72 ) (322 + 92 ) = 1 + 2422 0 mod 1105
(c3) a = 33, b = 4
row : 1105 : 268 = 4 rem 33 (1)
row : 268 : 33 = 8 rem 4 4
(7.10)
row i=1: 33 : 4= 8 rem 1 0 1 33
row m=2: 4: 1= 4 rem 0 1 8 268
row m+1: 4 33 1105
The doubled self-symmetric algorithm starts with the division 1105 : 47. The second
half of the algorithm starts with the division 24 : 23. We get the integer combination
gcd(33, 4) = 1 = 1 33 8 4
44
and the Gaussian product
(c4) a = 31, b = 12
The doubled self-symmetric algorithm starts with the division 1105 : 242. The second
half of the algorithm starts with the division 32 : 9. We get the integer combination
Theorem 7.3 (Solution for square free integers). Assume that A 3 has only simple
prime factors, also called square free. Under that additional assumption, the number of
solutions of Descartes problem is equal to the number of solutions of the congruence
A
(imag) 1 + J2 0 mod A and 1J <
2
45