Skip to content

Commit 88af52a

Browse files
committed
(237 templates) Added codex puzzles up until 36
1 parent e4a6504 commit 88af52a

File tree

3 files changed

+1010
-1016
lines changed

3 files changed

+1010
-1016
lines changed

problems/README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,18 +2285,12 @@ def sat(ans: List[int], m: int=1408862, n: int=2113293):
22852285
```python
22862286
def sol(m=1408862, n=2113293):
22872287
def gcd_cert(small, big):
2288-
"""Returns gcd, a, b, such that small * a + big * b == gcd
2289-
"""
2288+
"""Returns gcd, a, b, such that small * a + big * b == gcd"""
22902289
assert 0 < small <= big
22912290
if big % small == 0:
22922291
return [small, 1, 0]
2293-
d = big // small
22942292
gcd, a, b = gcd_cert(big % small, small)
2295-
# above guarantees a * (big % small) + b * small == gcd
2296-
# combined with (big % small) == big - small * d
2297-
# gives a * (big - small * d) + b * small == gcd
2298-
# or equivalently (b - a * d) * small + a * big == gcd
2299-
return [gcd, (b - a * d), a]
2293+
return [gcd, b - a * (big // small), a]
23002294

23012295
if m < n:
23022296
return gcd_cert(m, n)

0 commit comments

Comments
 (0)