Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Programming Praxis, 15 June 2012

View count_ones.hs
1 2 3 4 5 6 7 8
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
Something went wrong with that request. Please try again.