
@Arjun Comar: I would like this walkthrough!
2015-01-27 22:37 GMT-03:00 Brandon Allbery
On Tue, Jan 27, 2015 at 8:33 PM, Jean Lopes
wrote: sum [3,6..9999999] Takes ~1 second to return, and these are just the multiples of 3, to get
Just to illustrate what I am saying: for instance this function the real answer I would have to first sum the multiples of 5 and 15...
Yes, and what people are telling you is how to do this without generating and iterating through the list, just using the description of it. This is the key to Euler problems; you're using the brute force solution, not the math that lets you skip the slow part and get the answer immediately.
(I've been keeping quiet because I'm not very good at this kind of math myself; I just recognize that Euler problems are always looking for it and that almost any time you find yourself iterating through a generated list of numbers, you're doing it wrong. Even in the cases where you *do* need to do so, there's usually some math that will cut the search space down considerably; you'll run into this if you do one of the Euler problems involving prime numbers, most likely.)
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners