Skip to content

Instantly share code, notes, and snippets.

@monzou
Created June 17, 2012 02:50
Show Gist options
  • Save monzou/2943234 to your computer and use it in GitHub Desktop.
Save monzou/2943234 to your computer and use it in GitHub Desktop.
import Data.Char
import Data.List
main = print $ firstTo 40
digitSum :: Int -> Int
digitSum = sum . map digitToInt . show
firstTo :: Int -> Maybe Int
firstTo n = find (\x -> digitSum x == n) [ 1.. ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment