You are viewing a single comment's thread. Return to all comments →
for python,
import sys t = int(input().strip()) for a0 in range(t): sum = 0 n = int(input().strip()) x, y, z = (n-1)//3, (n-1)//5, (n-1)//15 sum = 3*x*(x+1) + 5*y*(y+1) - 15*z*(z+1) print(sum//2)
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 →
for python,