This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def GCD(a,b): | |
g = [max(a,b),min(a,b)] | |
mass = [[max(a,b),min(a,b)]] | |
while g[0] != 0 and g[1] != 0: | |
g[0], g[1] = g[1], g[0] % g[1] | |
mass.append([g[0],g[1]]) | |
return mass, g[0] | |
def euclid_ext(a, b): | |
if b == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from math import pow | |
a = random.randint(2, 10) | |
def gcd(a, b): | |
if a < b: | |
return gcd(b, a) | |
elif a % b == 0: | |
return b; |
OlderNewer