Super-d numbers: Difference between revisions

m
→‎{{header|Haskell}}: applied hindent (and <*>) for Rosetta 80 char width limit
m (→‎{{header|Haskell}}: applied hindent (and <*>) for Rosetta 80 char width limit)
Line 297:
 
isSuperd :: (Show a, Integral a) => a -> a -> Bool
isSuperd p n =
isSuperd p n = (replicate (fromIntegral<*> pintToDigit) (intToDigit $ fromIntegral p) `isInfixOf` show (p * n ^ p)
 
findSuperd :: (Show a, Integral a) => a -> [a]
findSuperd p = filter (isSuperd p) [1 ..]
 
main :: IO ()
main =
main = mapM_ (\n -> putStrLn ("First 10 super-" ++ show n ++ " : " ++ (show . take 10 $ findSuperd n))) [2..6]</lang>
mapM_
(putStrLn .
("First 10 super-" ++) .
main = mapM_ (\n -> putStrLn ("First 10 super-" (++) . show n ++<*> ((" : " ++) . (show . take 10 $. findSuperd n))) [2..6]</lang>
[2 .. 6]</lang>
{{out}}
<pre>
9,655

edits