Jacopi Patch 1

Made some modifications to the Jacopi function. It's still returning
wrong outputs for some test vectors though. Just to clarify, the last
patch also introduced Miller-Rabin and Fermat primality tests.