Numbers divisible by their individual digits, but not by the product of their digits.: Difference between revisions
Numbers divisible by their individual digits, but not by the product of their digits. (view source)
Revision as of 21:31, 10 April 2021
, 3 years ago→{{header|Haskell}}: Applied Hlint, Ormolu, pruned one import.
(Added Algol W) |
m (→{{header|Haskell}}: Applied Hlint, Ormolu, pruned one import.) |
||
Line 479:
=={{header|Haskell}}==
<lang haskell>import
import Text.Printf
divisible :: Int -> Bool
divisible = divdgt
where
dgt =
divdgt x d =
notElem
&& 0 /= x `mod` product d
&& all ((0 ==) . mod x) d
numbers :: [Int]
numbers = filter divisible [1 ..]
main :: IO ()
main = putStr $ unlines $ map (concatMap $ printf "%5d")
where
{{out}}
|