Prime

There are 3 functions provided: primeq, bigprimeq and nextPrime.

Primality Test

primeq

Primality test of an integer is a common tasks in number theory. primeq is a rigorous primality test function. It takes an integer argument n.

service url:
http://nzmath-json.appspot.com/prime/primeq/n/

Returned value will be a boolean, true or false.

Note that this test may time-out.

Probable Prime Test

bigprimeq

Sometimes, it is sufficient to know probable primality of a number. A probable primality test can be much faster than rigorous one. bigprimeq is essentially a Miller-Rabin test function. It takes an integer argument n.

service url:
http://nzmath-json.appspot.com/prime/bigprimeq/n/

Returned value will be a boolean, true or false. The error probability for false positive is less than 4-20.

Prime Generation

nextPrime

What is the smallest prime more than 1 million? Such a question can be answered by nextPrime. It takes an integer argument n.

service url:
http://nzmath-json.appspot.com/prime/nextPrimeq/n/

Returned value will be the smallest prime strictly bigger than the given n. Note that this test may time-out as primeq.