@Korkin/

euler1

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import sys


n = 1000
if n == 0:
    print(0)
else:
  n -= 1
threeMults = int(n/3)
sum = int(3*(threeMults*(threeMults+1)))>>1
fiveMults = int(n/5)
sum += int(5*fiveMults*(fiveMults+1))>>1
doubleMults = int(n/15)
sum -= int(15*doubleMults*(doubleMults+1))>>1
print(int(sum))