Narcissistic decimal number: Difference between revisions

Content added Content deleted
(Perl 6 entry)
mNo edit summary
Line 6: Line 6:
The task is to generate and show here, the first 25 narcissistic numbers.
The task is to generate and show here, the first 25 narcissistic numbers.


=={{header|Perl6}}==
=={{header|Perl 6}}==
Here is a straightforward, naive implementation. Should work but takes ages.
Here is a straightforward, naive implementation. Should work but takes ages.
<lang perl6>sub is-narcissic(Int $n) { $n == ([+] $n.comb)**$n.chars }
<lang perl6>sub is-narcissic(Int $n) { $n == ([+] $n.comb)**$n.chars }


say (grep &is-narcissic, 0 .. *)[^15];</lang>
say (grep &is-narcissic, 0 .. *)[^25];</lang>


=={{header|Python}}==
=={{header|Python}}==