7 kyu
Numbers Which Sum of Powers of Its Digits Is The Same Number
1,195 of 3,215raulbc777
Description:
Not considering number 1, the integer 153 is the first integer having this property: the sum of the third-power of each of its digits is equal to 153. Take a look: 153 = 1³ + 5³ + 3³ = 1 + 125 + 27 = 153
The next number that experiments this particular behaviour is 370 with the same power.
Write the function eq_sum_powdig()
, that finds the numbers below a given upper limit hMax
(inclusive) that fulfills this property but with different exponents as the power for the digits.
eq_sum_powdig(hMax, exp): ----> sequence of numbers (sorted list) (Number one should not be considered).
Let's see some cases:
eq_sum_powdig(100, 2) ----> []
eq_sum_powdig(1000, 2) ----> []
eq_sum_powdig(200, 3) ----> [153]
eq_sum_powdig(370, 3) ----> [153, 370]
Enjoy it !!
Fundamentals
Mathematics
Data Structures
Similar Kata:
Stats:
Created | Sep 29, 2015 |
Published | Sep 29, 2015 |
Warriors Trained | 7066 |
Total Skips | 499 |
Total Code Submissions | 8429 |
Total Times Completed | 3215 |
Python Completions | 1195 |
Ruby Completions | 153 |
JavaScript Completions | 921 |
Java Completions | 487 |
C# Completions | 246 |
Haskell Completions | 103 |
Clojure Completions | 53 |
CoffeeScript Completions | 19 |
C Completions | 63 |
C++ Completions | 159 |
Total Stars | 96 |
% of votes with a positive feedback rating | 92% of 427 |
Total "Very Satisfied" Votes | 370 |
Total "Somewhat Satisfied" Votes | 49 |
Total "Not Satisfied" Votes | 8 |