Replaced use of alarm with fork (more robust).
Also added a parameter to limit primes allowed for integration.