develooper Front page | perl.golf | Postings from August 2002

Re: Factorial and large numbers.

Thread Previous | Thread Next
From:
Markus Laire
Date:
August 8, 2002 14:28
Subject:
Re: Factorial and large numbers.
Message ID:
3D530C95.32096.2BFFD63@localhost
>>$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.

-- 
Markus Laire 'malaire' <markus.laire@nic.fi>



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About