From:

Date:

August 9, 2002 00:46Subject:

Re: Factorial and large numbers.Message ID:

Pine.LNX.3.96.1020809084506.3192A-100000@gentooOn Fri, 9 Aug 2002, Markus Laire wrote: > >>$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,$/ > >> 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.htm > > That seems to be allmost the same lookup method I came up with, > except that it uses unnecessary large table (100 items instead of 25) > and base 5 instead of 25 which doubles the steps. > See the bottom of http://cpp-home.com/contests/16/code.cpp for another method that only uses one lookup table. I too concluded that any such method was too long though. -- Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/ "This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01Thread 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