Skip to content

SebastianHerzog/kata-sumdigpower-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SumDigPower Kata

Take a Number And Sum Its Digits Raised To The Consecutive Powers

The number 89 is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata. What's the use of saying "Eureka"? Because this sum gives the same number.

In effect: 89 = 8^1 + 9^2

The next number in having this property is 135.

See this property again: 135 = 1^1 + 3^2 + 5^3

We need a function to collect these numbers, that may receive two integers a, b that defines the range [a, b] (inclusive) and outputs a list of the sorted numbers in the range that fulfills the property described above.

If there are no numbers of this kind in the range [a, b] the function should output an empty list.

Task

The code is difficult to undestand. How the the algorithm work? Can you extract functions or intermediary variables? Please help making this easier to understand!

Gitpod Ready-to-Code

About

Clean Code Example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%