a = 3
b = 5
current = 0

def nearest_multiple_of_a_or_b_to_current(current, a, b):
    distance_to_a = a - current % a
distance_to_b = b - current % b
return current + min(distance_to_a, distance_to_b)
for i in range(100):
    next = nearest_multiple_of_a_or_b_to_current(current, a, b)
print(next - current)
current = next
Вычислить разницу между кратными двух разных чисел