You are viewing a single comment's thread. Return to all comments →
t = int(input().strip()) for a in range(t): n = int(input().strip()) lst = [] sum = 0 for b in range((n//5)+1): if b * 5 != n and (b*5) not in lst: lst.append(b*5) for c in range((n//3)+1): if c * 3 != n and (c * 3) not in lst: lst.append(c*3) for item in lst: sum += item print(sum)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all comments →