about | help | code help+videos | done | prefs |
A number is said to be Lisarmium if the sum of its digits raised to their respective positions is the number itself. For this purpose, the positions start at the left end of the number. For example, 752 has 7 in the first position, 5 in the second position, and 2 in the third position. So to be a lisarmium number 7^1+5^2+2^3 would have to equal 752, which it does not. Therefore 752 is NOT a lisarmium number. However, 135 IS a lisarmium number because 1^1+3^2+5^3=135. Write a method that returns 'true' if 'num' is a lisarmium number and 'false' otherwise. test2020_11_12_P1SLHL_lisarmium(89798) → false test2020_11_12_P1SLHL_lisarmium(891247) → false test2020_11_12_P1SLHL_lisarmium(135) → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy