Jump to content

Narcissistic decimal number: Difference between revisions

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

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.