Yes, compiled C code is much faster than perl for this task, I'm afraid. I have a C version that runs over 100 times faster
than the perl, so it completes in a fraction of a second. I used GMP
, which provides a wide
variety of functions and has optimized assembly code for many platforms. Pari
seems to be a bit faster, but the documentation is way over my head.
I see Math::BigIntFast is available in PPM form. Someone who was feeling ambitious could probably make that work, but the rational number support would have to be written.