[Jprogramming] Fast Factorial

David Vaughan purpleblues13 at googlemail.com
Wed Nov 2 01:23:49 HKT 2011


I am trying to get the factorial of very large numbers, but I only care about the last 5 digits before the trailing zeros. So, I was hoping to do this:

rtz =: %&10 ^: (0: = 10&|) ^:_			NB. remove trailing zeros of y
f =: 100000&| @ rtz @ */@:>:@i.		NB. get the last 5 non-zero digits of y

Though I am not sure that it is doing exactly as I was hoping.

My question is, does f do 100000&| @ rtz in between every multiplication or does it actually only apply itself at the end once?

Thanks.


More information about the Programming mailing list