Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Super-d-numbers/Haskell/super-d-numbers.hs
Normal file
17
Task/Super-d-numbers/Haskell/super-d-numbers.hs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Data.List (isInfixOf)
|
||||
import Data.Char (intToDigit)
|
||||
|
||||
isSuperd :: (Show a, Integral a) => a -> a -> Bool
|
||||
isSuperd p n =
|
||||
(replicate <*> intToDigit) (fromIntegral p) `isInfixOf` show (p * n ^ p)
|
||||
|
||||
findSuperd :: (Show a, Integral a) => a -> [a]
|
||||
findSuperd p = filter (isSuperd p) [1 ..]
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
mapM_
|
||||
(putStrLn .
|
||||
("First 10 super-" ++) .
|
||||
((++) . show <*> ((" : " ++) . show . take 10 . findSuperd)))
|
||||
[2 .. 6]
|
||||
Loading…
Add table
Add a link
Reference in a new issue