<div dir="ltr"><div><div><div><div><div>Matthias,<br><br></div>Attached are source code files primality.m, primes.m, ap.m, test_primeFactors.m, test_primes.m, and test_prime.m. The file primality.m with the constants file, ap.m, implement Miller-Rabin. I've tested the implementation using an Apple PPC machine running Mercury-13.05.1 and also on a Mac Pro under Ubuntu running Mercury-14.01.1. They pass the tests I performed.<br><br></div>When running test_primes/2 using two 40-digit numbers with the second number 5000 larger than the first, I encountered a crash on the PPC machine: Uncaught Mercury exception: Software error: detected infinite recursion in func primality.powm/4. When I test pown/4 as a standalone using large numbers, I'm able to get correct results, so it may be that a process upstream of powm/4 is a problem. I'm looking into this.<br><br></div>The naming convention for constant valued big integers is ap.n63, for example, for integer(63). The integer(N) feature doesn't work on the PPC machine for large values of N. I have been able to use a conversion from string to big integer to get around that problem. The solution works as well on x86-64 machines.<br><br></div>Best regards,<br></div>Robert Buckley<br></div>