Skip to content

Instantly share code, notes, and snippets.

@evertlammerts
Created July 28, 2017 08:02
Show Gist options
  • Save evertlammerts/587a904b5df2c6a2429854c5b0537db1 to your computer and use it in GitHub Desktop.
Save evertlammerts/587a904b5df2c6a2429854c5b0537db1 to your computer and use it in GitHub Desktop.
def a(m, f):
m, f, g = min(m, f), max(m, f), 0
while f % m != 0:
g += f // m
m, f = f % m, m
g += f // m
return (m == 1 and str(g)) or 'impossible'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment