I found projecteuler few days ago and now Im stuck at problen 20!
I have absolutely no idea how Im supposed to do that.
The Problem is:
n! = n * (n-1) * (n-2) *...* 1
What is the sum of numbers of the 100! ?
Name:
Anonymous2007-07-09 6:23 ID:/NtzHmNM
Oh and my tools are Pen & paper, C++, calculator, two hands and half of brains
Name:
Anonymous2007-07-09 6:40 ID:kVgM2XfO
What don't you understand? Calculate 100! and add up all the numbers from that answer.
Name:
Anonymous2007-07-09 6:43 ID:/NtzHmNM
but that 100! have more that 130 numbers! Is there some kind of variable in C++ which can hold up to 130 numbers?
It's not about the most efficient way, it's about being able to do it at all in your language
Name:
Anonymous2007-07-09 9:52 ID:Qzhd/FZU
personally, i think your supposed to do it using only the standard libraries of your language and not some bignum package, otherwise, why would they make such a simple question?
Like the other one, calculate 2**1000, almost everyone on the forums just used a bignum package and circle-jerked over whose language could do it in the least number of lines, whereas only a handful of people got the point and used leftshifts and carry digits to calculate it, without bignum.
Name:
Anonymous2007-07-09 10:30 ID:kVgM2XfO
I think you're supposed to solve it elegantly and efficiently. Whether or not you use bignum isn't really important, as long as you understand the concept of what exactly you are doing with it.
Name:
Anonymous2007-07-18 13:49 ID:cA1NazQM
With a decent calculator (TI-83+), just input "100!".