Skip to content

Instantly share code, notes, and snippets.

@mheijkoop
Created July 7, 2013 14:47
Show Gist options
  • Save mheijkoop/5943696 to your computer and use it in GitHub Desktop.
Save mheijkoop/5943696 to your computer and use it in GitHub Desktop.
def multiple_of_three_or_five(x:Int) = x % 3 == 0 || x % 5 == 0
def sum_of_multiples(upperlimit: Int) =
(for (n <- 1 until upperlimit if multiple_of_three_or_five(n)) yield n).sum
println(sum_of_multiples(1000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment