Benjamin Serrato wrote:
Hello,

I'm trying to correctly solve the first projecteuler.net problem. The question is as so: Find the sum of all the multiples of 3 or 5 below 1000.

Also consider that the sum of consecutive integers between 1 and n is n*(n+1)/2.
Calculate that for 1..333 then multiply by 3
Calculate that for 1..199 then multiply by 5
add those
Calculate that for 1..66 then multiply by 15
subtract that from the total

I think that will give you the answer with minimal computation time.
-- 
Bob Gailer
Chapel Hill NC 
919-636-4239


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to