posted 5 years ago

i just solved #48

it was the easiest one so far(almost trivial) although fewer people have solved it than earlier problems which were harder for me. i credit the BigInteger class for this. i am thinking it must be harder to deal with huge numbers in other languages. any comments?

The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.

Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.

it was the easiest one so far(almost trivial) although fewer people have solved it than earlier problems which were harder for me. i credit the BigInteger class for this. i am thinking it must be harder to deal with huge numbers in other languages. any comments?

SCJP

Visit my download page

Matthew Brown

Bartender

Posts: 4568

9

posted 5 years ago

Yeah, that one is pretty trivial in any language that has an unlimited integer type. If you want more of a challenge, try doing it without BigInteger - or just move on to the next one .

Have a look at problem 97. That's another one that is trivial in theory with BigInteger, but you may find it will take ages that way - to get it down to a reasonable time you need to implement your own method to take advantage of the fact that it only wants the last 10 digits.

Have a look at problem 97. That's another one that is trivial in theory with BigInteger, but you may find it will take ages that way - to get it down to a reasonable time you need to implement your own method to take advantage of the fact that it only wants the last 10 digits.

It is sorta covered in the JavaRanch Style Guide. |