Comments on snippet: 'Project Euler: Add all the natural numbers below one thousand that are multiples of 3 or 5.'Snipplr comments feed
https://snipplr.com/
Fri, 17 Sep 2021 12:13:20 +0000marcospereira said on 22/Dec/2008
https://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://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://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://snipplr.com/view/10460/project-euler-add-all-the-natural-numbers-below-one-thousand-that-are-multiples-of-3-or-5