From:

Date:

August 8, 2002 13:18Subject:

Re: Factorial and large numbers.Message ID:

aiujmt$nu$1@post.home.lunixIn article <3D52E88C.16537.23333D2@localhost>, "Markus Laire" <markus.laire@nic.fi> writes: > You need to regex last zeroes AND remove extra numbers in the > beginning keeping only last 6 (or so) numbers. Interesting enough you need 6 when counting up and 5 when counting down > > I can't resist mentioning my other solution which doesn't compute n! > at all, but just uses kind-of 3D lookup-table to find the result. > It's fast but unfortunately code is far too long :( > > $z=pop;sub g{vec"\x10\xd7\xa9\x98b\xef",pop,2} > print$z<2||(1+g$z%25)*(1,3,2,4)[g 24-$z/25%25]*6*(1+g$z/625)%10,$/ > > Explanation would be somewhat longer, but if anyone wants I can write > it. > > Has anyone else tried lookup instead of computing n!. I'd like to > know shortest possible solution for this sub-problem also. > For a general direct method, see http://www.mathpages.com/home/kmath489.htmThread Previous | Thread Next

- Factorial and large numbers. by Tor Hildrum
- Re: Factorial and large numbers. by Markus Laire
**Re: Factorial and large numbers.**by perl-golf- Re: Factorial and large numbers. by Markus Laire
- Re: Factorial and large numbers. by Stephen Turner
- Re: Factorial and large numbers. by Eugene van der Pijll
- Re: Factorial and large numbers. by Tor Hildrum

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About