@@ -17,7 +17,9 @@ def diophantine(a, b, c):
1717
1818 """
1919
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
2123 (d , x , y ) = extended_gcd (a , b ) # extended_gcd(a,b) function implemented below
2224 r = c / d
2325 return (r * x , r * y )
@@ -32,6 +34,7 @@ def diophantine(a, b, c):
3234
3335# n is the number of solution you want, n = 2 by default
3436
37+
3538def diophantine_all_soln (a , b , c , n = 2 ):
3639 """
3740 >>> diophantine_all_soln(10, 6, 14)
@@ -66,6 +69,7 @@ def diophantine_all_soln(a, b, c, n=2):
6669
6770# Euclid's Algorithm
6871
72+
6973def greatest_common_divisor (a , b ):
7074 """
7175 >>> greatest_common_divisor(7,5)
@@ -117,8 +121,8 @@ def extended_gcd(a, b):
117121# import testmod for testing our function
118122from doctest import testmod
119123
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