Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
PrimeGen


NAME

PrimeGen - implementation of a prime number generator

SYNOPSIS

PROCEDURE Generate(test: Primes.Test; n: INTEGER; 
                   pLeast: REAL;
                   VAR prime: IntOperations.Operand);

DESCRIPTION

PrimeGen is an implementation of a prime number generator using QuickPrimeTest to speed up the generation, and a probabilistic testing algorithm given as a parameter (see Lehmann and RabinMiller). Prime number generation, particularly if large prime numbers are wanted, is time-consuming. Large prime numbers means for example n set to 512.

Generate generates a prime number in $[ 2 sup {n-1}..2 sup n )$. The probability that the generated number is prime is greater or equal than pLeast. test specifies the used probabilistic testing algorithm and the result is stored in the already initialized value prime which must be large enough for n bits (check with IntOperations.IsLargeEnoughFor).

DIAGNOSTICS

PrimeGen asserts that the variable used for storing the prime number is already initialized and that the type of prime is large enough for n bits.

AUTHOR

Frank B.J. Fischer

SEE ALSO

IntOperations
generic interface for arithmetic integer operations
Primes
general abstraction for primality testing algorithms
QuickPrimeTest
quick test for small primes
RabinMiller
implementation of the Rabin-Miller primality test algorithm
Lehmann
implementation of the Lehmann primality test algorithm

Edited by: borchert, last change: 1997/04/03, revision: 1.1, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module