Skip to content

Instantly share code, notes, and snippets.

@5outh
Created August 15, 2012 23:07
Show Gist options
  • Save 5outh/3364532 to your computer and use it in GitHub Desktop.
Save 5outh/3364532 to your computer and use it in GitHub Desktop.
Euler057
import Fraction
main = return . length . filter moreInNum . map sqrtTwo $ [1..1000]
where moreInNum f = length ( (show . num) f ) > length ( (show . denom) f)
sqrtTwo = simplify . (+) 1 . sqrtTwo'
where sqrtTwo' 1 = 1 % 2
sqrtTwo' n = 1 / ( 2 + sqrtTwo' (pred n) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment