Brilliant numbers: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: Added a draft solution in Haskell) |
|||
Line 450: | Line 450: | ||
isBrilliant :: (Integral a, Show a) => a -> Bool |
isBrilliant :: (Integral a, Show a) => a -> Bool |
||
isBrilliant n = case primeFactors n of |
isBrilliant n = case primeFactors n of |
||
[a, b] -> |
[a, b] -> length (show a) == length (show b) |
||
n == (a * b) |
|||
&& length (show a) == length (show b) |
|||
_ -> False |
_ -> False |
||
Line 499: | Line 497: | ||
(242,10201) |
(242,10201) |
||
(2505,100013)</pre> |
(2505,100013)</pre> |
||
=={{header|J}}== |
=={{header|J}}== |