Comments on snippet: 'Project Euler: Add all the natural numbers below one thousand that are multiples of 3 or 5.'Snipplr comments feed
https://ipv6.snipplr.com/
Sat, 01 Oct 2022 06:00:04 +0000marcospereira said on 22/Dec/2008
https://ipv6.snipplr.com/view/10460/project-euler-add-all-the-natural-numbers-below-one-thousand-that-are-multiples-of-3-or-5
<p>Or you could just write one single line:
(1..999).findAll { it % 3 == 0 || it % 5 ==0 }.sum()
Kind Regards</p>Mon, 22 Dec 2008 13:16:50 UTChttps://ipv6.snipplr.com/view/10460/project-euler-add-all-the-natural-numbers-below-one-thousand-that-are-multiples-of-3-or-5marcospereira said on 22/Dec/2008
https://ipv6.snipplr.com/view/10460/project-euler-add-all-the-natural-numbers-below-one-thousand-that-are-multiples-of-3-or-5
<p>Or maybe the math way if you consider that multiples will form a [arithmetic progression](http://en.wikipedia.org/wiki/Arithmetic_progression).</p>Mon, 22 Dec 2008 13:29:00 UTChttps://ipv6.snipplr.com/view/10460/project-euler-add-all-the-natural-numbers-below-one-thousand-that-are-multiples-of-3-or-5