Loading...
Loading...
Loading...
Two machines repeat every a and every b minutes. Print the greatest common divisor of a and b, and the least common multiple, which is when they next start together.
Example
Input
84 36
Output
12 252
GCD 12, LCM 252.
Try the problem first. Open one hint at a time.
Use math.gcd.
lcm(a, b) equals a // gcd * b.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor