Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ehamberg
Created June 15, 2012 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehamberg/2935580 to your computer and use it in GitHub Desktop.
Save ehamberg/2935580 to your computer and use it in GitHub Desktop.
Programming Praxis, 15 June 2012
import qualified Data.MemoCombinators as Memo
f = Memo.integral f'
where f' :: Int -> Int
f' 1 = 1
f' n = (length . filter (== '1') . show) n + f (n-1)
main = (print . head . filter (uncurry (==))) $ zip [2..] $ map f [2..]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment