Skip to content

Instantly share code, notes, and snippets.

@cmoore
Created June 18, 2009 03:40
Show Gist options
  • Save cmoore/131681 to your computer and use it in GitHub Desktop.
Save cmoore/131681 to your computer and use it in GitHub Desktop.
import Data.List (sort)
problem_four :: Int
problem_four =
head . reverse . sort $
filter (>0) $ concat $ map (\x ->
map( \y -> fix x y ) nx
) nx
where
nx :: [ Int ]
nx = [ 100 .. 999 ]
is_pal :: Int -> Int
is_pal x =
case ( show x ) == ( reverse $ show x ) of
True ->
x
_ -> 0
fix :: Int -> Int -> Int
fix x y =
is_pal $ x * y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment