MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / gcd

Function gcd

src/gamesbyexample/affinecipher.py:141–146  ·  view source on GitHub ↗

Return the Greatest Common Divisor of a and b using Euclid's Algorithm.

(a, b)

Source from the content-addressed store, hash-verified

139
140
141def gcd(a, b):
142 """Return the Greatest Common Divisor of a and b using
143 Euclid's Algorithm."""
144 while a != 0:
145 a, b = b % a, a
146 return b
147
148
149def findModInverse(a, m):

Callers 3

checkKeyFunction · 0.85
generateRandomKeyFunction · 0.85
findModInverseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected