number have exactly k digits. Raise every digit to the power k and add the results up.
Return true if the sum equals number itself, and false otherwise.number=370 → True
Three digits, so the power is 3: 3³ + 7³ + 0³ = 27 + 343 + 0 = 370.
number=25 → False
2² + 5² = 29 ≠ 25.
number=8 → True
A one-digit number always equals itself to the first power.
number=370
True
Run checks the first 3 tests in your browser. Submit checks all 53 tests on the server, hidden ones included.