Narcissistic or Armstrong Number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Narcissistic or Armstrong Number

Narcissistic number is a number that is the sum of its own digits each raised to the power of the number of digits. - wikipedia. Example: 153 = 1^3 + 5^3 + 3^3 370 = 3^3 + 7^3 + 0^3 The largest known base 10 Narcissistic number is 39 digits long 115132219018763992565095597973971522401 Here's my solution to check if a number is narcissistic: https://code.sololearn.com/cuKffMRrxnJK Please suggest how to optimize it more.

1st Jul 2017, 10:50 AM
Salekin
Salekin - avatar
1 Answer
+ 6
Interesting. The number 9 is also a special number, the sum of all digits of any multiplication of 9 will give 9. 2*9 = 18, 1+8=9, 3*9=27, 2+7=9, 4*9=36, 3+6=9, etc. Also a kind of "narcissism." =)
1st Jul 2017, 11:39 AM
Karl T.
Karl T. - avatar