Smallest power of 6 whose decimal expansion contains n: Difference between revisions

m
→‎{{header|Haskell}}: Applied Hlint, Ormolu
(Added Algol 68)
m (→‎{{header|Haskell}}: Applied Hlint, Ormolu)
Line 347:
 
=={{header|Haskell}}==
<lang haskell>import ControlData.MonadList (isInfixOf)
import DataText.ListPrintf (printf)
import Text.Printf
 
sixes :: [Integer]
sixes = iterate (* 6) 1
 
smallest :: Integer -> Integer
smallest n =
smallest n = head $ filter (\r -> show n `isInfixOf` show r) sixes
head $
filter
smallest n = head $ filter (\r -> (show n `isInfixOf`) . show r) sixes
sixes
 
main :: IO ()
main =
main = putStr $ concatMap (printf "%2d: %d\n" `ap` smallest) [0..21]</lang>
putStr $
concatMap
main = putStr $ concatMap (printf "%2d: %d\n" `ap`<*> smallest) [0..21]</lang>
[0 .. 21]</lang>
 
{{out}}
9,655

edits