Narcissistic decimal number: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: Faster version (search space reduced from integer series to unordered digit combinations)) |
|||
Line 1,078: | Line 1,078: | ||
===Reduced search (unordered digit combinations)=== |
===Reduced search (unordered digit combinations)=== |
||
As summing the nth power of the digits is unaffected by digit order, we can reduce the search space by filtering |
As summing the nth power of the digits is unaffected by digit order, we can reduce the search space by filtering digit combinations of given length and arbitrary order, rather than filtering a full integer sequence. |
||
<lang haskell>import Data.List (sort) |
<lang haskell>import Data.List (sort) |