Narcissistic decimal number: Difference between revisions
Content added Content deleted
(→{{header|Perl 6}}: removing output? template) |
m (→{{header|Perl 6}}: proper spelling) |
||
Line 8: | Line 8: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
Here is a straightforward, naive implementation. It works but takes ages. |
Here is a straightforward, naive implementation. It works but takes ages. |
||
<lang perl6>sub is- |
<lang perl6>sub is-narcissistic(Int $n) { $n == [+] $n.comb »**» $n.chars } |
||
for 0 .. * { |
for 0 .. * { |
||
if .&is- |
if .&is-narcissistic { |
||
.say; |
.say; |
||
last if ++state$ >= 25; |
last if ++state$ >= 25; |