Sum multiples of 3 and 5: Difference between revisions

Content added Content deleted
Line 2,900: Line 2,900:


let sum3or5 upto =
let sum3or5 upto =
mul3or5
mul3or5 |> Seq.take_while (fun n -> n < upto) |> Seq.fold_left (+) 0;;
|> Seq.take_while (fun n -> n < upto)
|> Seq.fold_left (+) 0;;


printf "The sum of the multiples of 3 or 5 below 1000 is %d\n" (sum3or5 1000);;
printf "The sum of the multiples of 3 or 5 below 1000 is %d\n" (sum3or5 1000);;