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]
eq_sum_powdig(100, 2) ----> []

eq_sum_powdig(1000, 2) ----> []

eq_sum_powdig(200, 3) ----> [153]

eq_sum_powdig(370, 3) ----> [153, 370]
eqSumPowdig(100, 2) ----> []

eqSumPowdig(1000, 2) ----> []

eqSumPowdig(200, 3) ----> [153]

eqSumPowdig(370, 3) ----> [153, 370]

Enjoy it !!

Fundamentals
Mathematics
Data Structures

Stats:

CreatedSep 29, 2015
PublishedSep 29, 2015
Warriors Trained7066
Total Skips499
Total Code Submissions8429
Total Times Completed3215
Python Completions1195
Ruby Completions153
JavaScript Completions921
Java Completions487
C# Completions246
Haskell Completions103
Clojure Completions53
CoffeeScript Completions19
C Completions63
C++ Completions159
Total Stars96
% of votes with a positive feedback rating92% of 427
Total "Very Satisfied" Votes370
Total "Somewhat Satisfied" Votes49
Total "Not Satisfied" Votes8
Ad
Contributors
  • raulbc777 Avatar
  • g964 Avatar
  • CrazyMerlyn Avatar
  • Voile Avatar
  • rowcased Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
  • farhanaditya Avatar
  • 66  Avatar
  • saudiGuy Avatar
Ad