Ultra's Brain dump What would UltraL0rd do?

19May/100

Project Euler : Problem 16 Solved

Okay, this is just getting too easy..
Next to nothing research, Re-use of old code.

I hope the next challenge is a bit more difficult. Maybe it is just because Java supports big ass numbers with a class I'm starting to use quite often in Project Euler, namely : BigInteger

But.. Really now..

Problem 16's solution goes as follows :
(yes, I know I said I wouldn't put up any solutions, but really now.. I'm not spoiling anyone's day here)

BigInteger bigInt = new BigInteger( "2" );
String bigNumber = bigInt.pow( 1000 ).toString();

Then loop through each character and add it using :

Integer.parseInt( Character.toString( aChar ) );

*Editors Note
Interesting development
Using Integer.parseInt( Character.toString( aChar ) ), Execution Time : 36ms
Using Character.digit( aChar,10 ), Execution Time : 0ms

Intelligence has officially been insulted!

The Problem is as follows :

"What is the sum of the digits of the number 2^1000?"

Tips :

  1. Read up!

Project Euler Stats :

Total Research Time : 0 Days
Total Coding Time : 5mins
Total Code Execution Time : 0ms

Posted by UltraL0rd