Skip to content

Instantly share code, notes, and snippets.

@cbilson
Created December 11, 2008 21:16
Show Gist options
  • Save cbilson/34877 to your computer and use it in GitHub Desktop.
Save cbilson/34877 to your computer and use it in GitHub Desktop.
#light
(*
Project Euler Problem 6
*)
let sumOfSquares n =
seq { 1 .. n } |> Seq.fold (fun a x -> a + float(x) * float(x)) 0.0
let squareOfSums n =
let sum = seq { 1 .. n } |> Seq.sum
float(sum * sum)
let problem6 =
(squareOfSums 100) - (sumOfSquares 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment