id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2020_12_10_SLHL_lisarmiumList
prev  |  next  |  chance

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. Return an array containing all of the lisarmium numbers from 1 up to 'top'. As a precondition, you may assume that 'top' will be between 1 and 20000.


test2020_12_10_SLHL_lisarmiumList(19000) → [1, 2, 3, 4, 5, 6, 7, 8, 9, 89, 135, 175, 518, 598, 1306, 1676, 2427]
test2020_12_10_SLHL_lisarmiumList(20000) → [1, 2, 3, 4, 5, 6, 7, 8, 9, 89, 135, 175, 518, 598, 1306, 1676, 2427]
test2020_12_10_SLHL_lisarmiumList(18) → [1, 2, 3, 4, 5, 6, 7, 8, 9]

...Save, Compile, Run (ctrl-enter)

public int[] test2020_12_10_SLHL_lisarmiumList(int top) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy