CoCoA:IsPPrime

From ApCoCoAWiki

IsPPrime

checks if an integer is a probable prime

Description

This function returns TRUE if its integer argument passes a fairly

stringent primality test; otherwise it returns FALSE. There is a very

small chance of the function returning TRUE even though the argument is composite; if it returns FALSE, we are certain that the argument is composite. Some people call it a compositeness test.

Example

  IsPPrime(2);
TRUE
-------------------------------
  IsPPrime(1111111111111111111);
TRUE
-------------------------------
  [N In 1..1111 | IsPPrime((10^N-1)/9)]; -- only five values are known
[2, 19, 23, 317, 1031]                 -- next might be 49081
-------------------------------

Syntax

IsPPrime(N:INT):BOOL

IsPrime

NextPPrime

   <type>boolean</type>
   <type>integer</type>