+ 5
[CHALLENGE!] Determine a Narcissistic Number
A Narcissistic Number is a number which is the sum of its own digits, each raised to the power of the number of digits. For example, take 153 (3 digits): 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 and 1634 (4 digits): 1^4 + 6^4 + 3^4 + 4^4 = 1 + 1296 + 81 + 256 = 1634 The Challenge: Your code must print true or false depending upon whether the given number is a Narcissistic number. Error checking for text strings or other invalid inputs is not required, only valid integers will be passed into the function.
16 Answers
+ 18
from where u all find different names to a same challenge
some call it armstong number , some call it crazy number & now narcissistic number ☺
+ 11
Challenge accepted!!
+ 5
Here is my try in Ruby:
https://code.sololearn.com/czQ1hoxZ7XQb/#rb
+ 4
https://www.sololearn.com/Discuss/909843/?ref=app ?
+ 3
+ 3
My try using Java. Works for both non-negative and negative numbers.
https://code.sololearn.com/cs1B52k1eklj/?ref=app
+ 3
Ruby:
gives all narcissistic numbers between 0 and 100000
https://code.sololearn.com/cL47tkm4cuAK
+ 2
+ 2
https://code.sololearn.com/cLSqXiLUP4Q5/?ref=app
+ 1
oneliner + list of nar6 numbers smaller than 400.000
https://code.sololearn.com/cIZ6a9JtpV6f/?ref=app
0
https://code.sololearn.com/cMfkiW4Yfi9x/?ref=app