All problems

LCM of Two Numbers

easyPythonMath

Two shuttle buses leave the same stop, one every a minutes and the other every b minutes, both setting off together at minute 0. The timetable needs the next minute at which they leave together again — the least common multiple of the two intervals.

Task: Read the two intervals and print the least common multiple.

Input

A single line holding two positive integers separated by a single space, each between 1 and 1,000,000.

Output

One line holding a single integer: the smallest positive whole number that both intervals go into exactly. It must print as a whole number, with no decimal point.

Example:

Input:
4 6

Output:
12

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…