Super-d numbers: Difference between revisions

no edit summary
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
No edit summary
Line 235:
found in 135616 ms
</pre>
=={{header|Haskell}}==
<lang haskell>import Data.List (isInfixOf)
import Data.Char (intToDigit)
 
superd :: (Show a, Integral a) => a -> a -> Bool
superd p n = replicate (fromIntegral p) (intToDigit $ fromIntegral p) `isInfixOf` show (p * n ^ p)
 
findSuperd :: (Show a, Integral a) => a -> [a]
findSuperd p = go [1..]
where go [] = []
go (n:ns)
| superd p n = n : go ns
| otherwise = go ns
 
main :: IO ()
main = mapM_ (\n -> putStrLn ("First 10 super-" ++ show n ++ " : " ++ (show . take 10 $ findSuperd n))) [2..6]</lang>
{{out}}
<pre>
First 10 super-2 : [19,31,69,81,105,106,107,119,127,131]
First 10 super-3 : [261,462,471,481,558,753,1036,1046,1471,1645]
First 10 super-4 : [1168,4972,7423,7752,8431,10267,11317,11487,11549,11680]
First 10 super-5 : [4602,5517,7539,12955,14555,20137,20379,26629,32767,35689]
First 10 super-6 : [27257,272570,302693,323576,364509,502785,513675,537771,676657,678146]
</pre>
=={{header|J}}==
<pre>
Anonymous user