Armstrong Number
A number with k digits is an Armstrong number if the sum of each digit raised to the power k equals the number itself.
Return True if n is an Armstrong number and False otherwise.
Example 1
n 153
returns true
1 + 125 + 27 = 153.
Example 2
n 123
returns false
1 + 8 + 27 = 36, not 123.
Constraints
1 <= n <= 10**6
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Base K to DecimalBeginner
- Collatz StepsBeginner
- Count DivisorsBeginner
- Decimal to Binary StringBeginner
- Digit Sum in Base KBeginner
- Digital RootBeginner
- Excel Sheet Column NumberBeginner
- Handshake CountBeginner