isprime - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


isprime

primality test

 

Calling Sequence

Parameters

Description

Examples

References

Calling Sequence

isprime(n)

Parameters

n

-

integer

Description

• 

The isprime command is a probabilistic primality testing routine. (See prime number.)

• 

It returns false if n is shown to be composite within one strong pseudo-primality test and one Lucas test. It returns true otherwise.

• 

If isprime returns true, n is very probably prime - see References section. No counterexample is known and it has been conjectured that such a counter example must be hundreds of digits long.

Examples

(1)

(2)

(3)

(4)

(5)

(6)

The Tabulate command can be used to display prime numbers in a grid. The following table highlights any prime numbers with a pink background.

(7)

 

Note that this procedure can be modified to show tables for various values of r and c.

References

  

Knuth, Donald E. The Art of Computer Programming. 2nd ed. Reading, Mass.: Addison-Wesley, 1997. Vol. 2 Section 4.5.4: Algorithm P.

  

Riesel, H. Prime Numbers and Computer Methods for Factorization. Basel: Birkhauser, 1994.

See Also

ithprime

nextprime

prevprime

type/prime

 


Download Help Document