#Perl, 27 +3 = 30 bytes
Perl, 27 +3 = 30 bytes
Run with -F
. Older versions of Perl might require you to run with -nF
instead, if -F
does not imply -n
.
grep$;+=$_**$#F,@F;say$_==$
Prints 1 if narcissistic, prints nothing otherwise.
(thanks to @Dada for byte-count correction, and for -2 bytes)