Created
November 5, 2016 23:20
-
-
Save OussaZaki/2a1f4d876226539096c96bcdc7f4d37a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum(n, k): | |
d = n // k | |
return k * (d * (d+1)) // 2 | |
def euler1(n): | |
return sum(n, 3) + sum(n, 5) - sum(n, 15) | |
t = int(input().strip()) | |
for i in range(t): | |
N = int(input().strip()) | |
print(euler1(N - 1)) # below N |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment