@@ -17,7 +17,9 @@ def diophantine(a, b, c):
17
17
18
18
"""
19
19
20
- assert c % greatest_common_divisor (a , b ) == 0 # greatest_common_divisor(a,b) function implemented below
20
+ assert (
21
+ c % greatest_common_divisor (a , b ) == 0
22
+ ) # greatest_common_divisor(a,b) function implemented below
21
23
(d , x , y ) = extended_gcd (a , b ) # extended_gcd(a,b) function implemented below
22
24
r = c / d
23
25
return (r * x , r * y )
@@ -32,6 +34,7 @@ def diophantine(a, b, c):
32
34
33
35
# n is the number of solution you want, n = 2 by default
34
36
37
+
35
38
def diophantine_all_soln (a , b , c , n = 2 ):
36
39
"""
37
40
>>> diophantine_all_soln(10, 6, 14)
@@ -66,6 +69,7 @@ def diophantine_all_soln(a, b, c, n=2):
66
69
67
70
# Euclid's Algorithm
68
71
72
+
69
73
def greatest_common_divisor (a , b ):
70
74
"""
71
75
>>> greatest_common_divisor(7,5)
@@ -117,8 +121,8 @@ def extended_gcd(a, b):
117
121
# import testmod for testing our function
118
122
from doctest import testmod
119
123
120
- if __name__ == ' __main__' :
121
- testmod (name = ' diophantine' , verbose = True )
122
- testmod (name = ' diophantine_all_soln' , verbose = True )
123
- testmod (name = ' extended_gcd' , verbose = True )
124
- testmod (name = ' greatest_common_divisor' , verbose = True )
124
+ if __name__ == " __main__" :
125
+ testmod (name = " diophantine" , verbose = True )
126
+ testmod (name = " diophantine_all_soln" , verbose = True )
127
+ testmod (name = " extended_gcd" , verbose = True )
128
+ testmod (name = " greatest_common_divisor" , verbose = True )
0 commit comments