Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
euler problem 06 with fsharp
open System
let squareOfSum n =
let i = n*(n+1)/2
i*i
let sumOfSquare n =
[1..n]
|> List.fold (fun acc x -> acc + x*x) 0
let solveEuler6 N =
(squareOfSum N)- (sumOfSquare N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment