Solved problem 25 with BigInteger