euler/v/euler001.v

11 lines
233 B
Coq
Raw Normal View History

2020-01-08 11:23:40 +00:00
import euler
2020-01-08 11:06:42 +00:00
fn multiples_of_three_and_five_below(n int) []int {
2020-01-08 11:23:40 +00:00
nums := euler.range(3, n-1)
return nums.filter(it % 3 == 0 || it % 5 == 0)
2020-01-08 11:06:42 +00:00
}
fn main() {
2020-01-08 11:23:40 +00:00
println(multiples_of_three_and_five_below(1000).reduce(euler.add, 0))
2020-01-08 11:06:42 +00:00
}