Skip to content

Instantly share code, notes, and snippets.

@kenprice
Created January 1, 2019 23:26
Show Gist options
  • Save kenprice/c87e0639bb12b740441687d080df0bff to your computer and use it in GitHub Desktop.
Save kenprice/c87e0639bb12b740441687d080df0bff to your computer and use it in GitHub Desktop.
Project Euler Problem 28
sumDiag :: Int -> Int
sumDiag 0 = 1
sumDiag x =
sumDiag (x-1) + (4 * x') - (12 * x)
where x' = ((x * 2) + 1) ^ 2
main :: IO()
main = putStrLn (show (sumDiag 500))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment