Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

100! = ?

Name: Anonymous 2007-07-09 6:18 ID:/NtzHmNM

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: Anonymous 2007-07-09 6:23 ID:/NtzHmNM

Oh and my tools are Pen & paper, C++, calculator, two hands and half of brains

Name: Anonymous 2007-07-09 6:40 ID:kVgM2XfO

What don't you understand? Calculate 100! and add up all the numbers from that answer.

Name: Anonymous 2007-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? 

Name: Anonymous 2007-07-09 6:58 ID:kVgM2XfO

libgmp + google

Name: Anonymous 2007-07-09 6:59 ID:/NtzHmNM

thanks anonymous

Name: Anonymous 2007-07-09 8:32 ID:DmG7YxKA

haskell:
product [1..100]

maple:
100!;

>>4 string?

or for the whole solution (Haskell again):
sum $ map Char.digitToInt $ show $ product [1..100]

Name: Anonymous 2007-07-09 8:56 ID:Heaven

It's not about the most efficient way, it's about being able to do it at all in your language

Name: Anonymous 2007-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: Anonymous 2007-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: Anonymous 2007-07-18 13:49 ID:cA1NazQM

With a decent calculator (TI-83+), just input "100!".

Name: Anonymous 2009-03-18 3:16

Don't call me gay, but I need some mary jay!

Marijuana MUST be legalized.

Don't change these.
Name: Email:
Entire Thread Thread List