10 lines
268 B
Python

def multi_in_num(limit, base):
count = limit // base
return (count + 1) * count * base // 2
def dual_multi_in_num(limit, a, b):
return multi_in_num(limit, a) + multi_in_num(limit, b) - multi_in_num(limit, a * b)
print(dual_multi_in_num(1000 - 1, 3, 5))