private static BigInteger divSum (BigInteger bigInt, BigInteger test)
{
if (test.equals(new BigInteger("1")))
{
return new BigInteger("1");
}
else if (bigInt.mod(test) == BigInteger.ZERO)
{
return test.add(divSum(bigInt, test.subtract(BigInteger.ONE)));
}
else
{
return divSum(bigInt, test.subtract(BigInteger.ONE));
}
}
It works fine for small numbers, however when I call
divSum (new BigInteger("10"), new BigInteger("10"))
JCreator sends a ton of error messages, and Stack Overflow being at the top. Other than being a website, I do not know much about it, besides also meaning that too much memory is used on the call stack. What options do I have to fix the situation?

New Topic/Question
Reply



MultiQuote




|