Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import fractions
- x = int(input())
- y = int(input())
- divider = x
- x = int(x / fractions.gcd(x, y))
- y = int(y / fractions.gcd(divider, y))
- stop = None
- otherX = 1
- otherY = 1
- while x != 1:
- stop = None
- while not stop:
- breuk = fractions.Fraction(x, y)
- breuk2 = fractions.Fraction(otherX, otherY)
- breuk3 = fractions.Fraction(otherX, otherY + 1)
- if breuk3 < breuk < breuk2:
- teller = x * (otherY + 1)
- noemer = y * (otherY + 1)
- andereTeller = y
- x = teller - andereTeller
- y = noemer
- divider = x
- x = int(x / fractions.gcd(x, y))
- y = int(y / fractions.gcd(divider, y))
- stop = True
- print(otherY + 1)
- otherY += 1
- print(y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement