public class PE0021 extends Problem
Modifier and Type | Field and Description |
---|---|
(package private) ArrayList<Long> |
cache
Stores all found amicable numbers.
|
Constructor and Description |
---|
PE0021()
|
Modifier and Type | Method and Description |
---|---|
private boolean |
isAmicable(int num)
Checks the given number to be a amicable number.
|
void |
prepare()
Just initializes the
cache as empty memory. |
String |
solve()
Runs a loop to 10000 and checks if the current number is amicable.
|
finish, getResult, getRuntime, toString
public PE0021()
public String solve()
isAmicable(int)
private boolean isAmicable(int num)
cache
is asked. If the number could not be found in
cache
the sum of divisors
is calculated.num
- the number to be checkedMathe.getSumOfDivisors(long)