Created
July 7, 2013 14:47
-
-
Save mheijkoop/5943696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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