CoCoA:IsPrime

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IsPrime

prime integer test

Description

This function determines whether a small integer is prime.

The range of permitted values for N is the same the range

of permitted values for the NextPrime function: on most platforms <formula>N <less_eq/> 45000</formula> should work fine, on some platforms considerably larger values will work. For N greater than the limit an error is raised.

Example

  IsPrime(32003);
TRUE
-------------------------------
  IsPrime(10^100);
ERROR: IsPrime: number too large
CONTEXT: Return(Error(<quotes>IsPrime: number too large</quotes>))
-------------------------------

Syntax

IsPrime(N:INT):BOOL

IsPPrime

NextPrime

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