loading
open in
main.py
1
2
3
4
5
6
7
8
9
10
def sumn(n, d): #sum numbers <= n that are divisible by d
    n //= d
    return d*n*(n+1) // 2

L = int(input('Enter a limit? how to win at boogle tips
'))
a, b = 3, 5

s = sumn(L-1, a) + sumn(L-1, b) - sumn(L-1, a*b)
print "Sum of multiples of",a,"or",b,"below", L, "=", s