Calculate the greatest common divisor of a and b
(a, b)
| 842 | return p |
| 843 | |
| 844 | def _gcd(a, b): |
| 845 | """Calculate the greatest common divisor of a and b""" |
| 846 | while b: |
| 847 | a, b = b, a % b |
| 848 | return a |
| 849 | |
| 850 | def _lcm(a, b): |
| 851 | return a // _gcd(a, b) * b |