Narcissistic or Armstrong Number | Sololearn: Learn to code for FREE!

+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.

7/1/2017 10:50:35 AM

Salekin

1 Answer

New 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." =)