Having a bit of a problem working on problem 16 on the project euler site.

Given BigInteger base = BigInteger.valueOf(2); for both examples...

<blockquote>code:<pre name="code" class="core"> BigInteger total = BigInteger.ZERO; total = base.pow(1000); </pre></blockquote>

gives different output than <blockquote>code:<pre name="code" class="core"> BigInteger total = BigInteger.ZERO; for (int i = 0; i < 1000; i++) { total = total.multiply(base); } </pre></blockquote>

I'm really at a loss. Perhaps it's late and I'm not thinking clearly, but later methods to sum up the individual digits of total aren't giving me the right answer.

The very existence of flamethrowers proves that at some time, some where, some place, someone once said to themselves "I'd really like to set those people on fire over there, but I just can't get close enough".

Just as an aside, I've done a fair number of the Project Euler problems in Java, and I've always considered using the BigInteger class as a bit of cheating. It's more interesting to come up with alternative solutions, IMO. The whole point is to learn about algorithms and math, after all.

Ping & DNS - updated with new look and Ping home screen widget