Homepage › Solution manuals › Kenneth Ireland › A Classical Introduction to Modern Number Theory › Exercise 1.3
Exercise 1.3
Calculate , , .
Answers
Proof. With direct instructions in Python, we obtain :
>>> a, b = 187, 221
>>> print("q = ",a//b); a, b = b, a%b; print(a,b)
q = 0
221 187
>>> print("q = ",a // b); a, b = b, a%b; print(a,b)
q = 1
187 34
>>> print("q = ",a // b); a, b = b, a%b; print(a,b)
q = 5
34 17
>>> print("q = ",a // b); a,b = b, a%b; print(a,b)
q = 2
17 0
This gives the equalities
So .
With the same instructions, we obtain
.
Finally
.
The Python script which gives the gcd is very concise :
def gcd(a,b): a, b = abs(a), abs(b) while b != 0: a, b = b, a % b return a
□
2022-07-19 00:00