共用方式為


Project Euler Problem #1

Project Euler is pretty darn cool. It’s a bunch of mathematical problems that require programming to solve. I’m having fun doing them in F#. They start very simple but quickly become more difficult.

Problem 1 is to find the sum of all the multiples of 3 or 5 among the natural numbers below 1000:

[1..999]
|> List.filter (fun x -> x % 3 = 0 or x % 5 = 0)
|> List.sum