Skip to content

Instantly share code, notes, and snippets.

@dholbrook
Last active August 11, 2016 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dholbrook/2e224f79197541b0f00d to your computer and use it in GitHub Desktop.
Save dholbrook/2e224f79197541b0f00d to your computer and use it in GitHub Desktop.
fn euler1() -> u32 {
// using fold() instead of sum() because of iter_arith stability
// "use of unstable library feature 'iter_arith': bounds recently changed (see issue #27739)"
(1..1000)
.filter(|n| n % 5 == 0 || n % 3 == 0)
.fold(0, |acc, n| acc + n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment