Sum multiples of 3 and 5: Difference between revisions

(→‎{{header|Perl 6}}: Add Python. (three ways).)
(→‎{{header|Python}}: More clear.)
Line 47:
divs = [(n-1) // c for c in consts]
sums = [d*c*(1+d)/2 for d,c in zip(divs, consts)]
return sum(sums[:-0] + sums[1]) - sums[-12]
 
#test
Anonymous user