Home > database >  Least common multiple
Least common multiple

Time:12-13

How to calculate the least common multiple of the numbers x and y, if we know the number z and by the condition x y = z. The answer does not work(

z = int(input())

ls = list(range(1, z))
my_ls = []

for i in ls:
    if z % i == 0:
        my_ls.append((i, z-i))
    else:
        continue

print(*min(my_ls))

CodePudding user response:

Your code only looks at the possible pairs of values of

  • Related