Sum of the digits of n is substring of n: Difference between revisions

m
Line 102:
main :: IO ()
main =
mapM_ putStrLn $ showMatches <$> [999, 10000]
showMatches digitSumIsSubString <$> [999, 10000]
 
showMatches :: (String -> Bool) -> Int -> String
showMatches p limit =
( show (length xs)
<> " matches in [0.."
Line 117 ⟶ 118:
<> "\n"
where
xs = filter p $ fmap show [0 .. limit]
xs =
filter digitSumIsSubString $
fmap show [0 .. limit]
w = length (last xs)
 
9,659

edits