Narcissistic decimal number: Difference between revisions
→{{header|Perl 6}}: adding output
(→{{header|Perl 6}}: adding output) |
|||
Line 11:
<lang perl6>sub is-narcissic(Int $n) { $n == [+] $n.comb »**» $n.chars }
for 0 .. * {
if .&is-narcissic {
.say;
last if ++state$ >= 25;
}
}</lang>
{{out}}
<pre>0
1
2
3
4
5
6
7
8
9
153
370
371
407
Ctrl-C</pre>
Here the program was interrupted but if you're patient enough you'll see all the 25 numbers.
=={{header|Python}}==
|