Fermat Primality Test - Algorithm and Running Time

Algorithm and Running Time

The algorithm can be written as follows:

Inputs: n: a value to test for primality; k: a parameter that determines the number of times to test for primality Output: composite if n is composite, otherwise probably prime repeat k times: pick a randomly in the range if, then return composite return probably prime

Using fast algorithms for modular exponentiation, the running time of this algorithm is O(k × log2n × log log n × log log log n), where k is the number of times we test a random a, and n is the value we want to test for primality.

Read more about this topic:  Fermat Primality Test

Famous quotes containing the words running and/or time:

    He’s like an express train running through a tunnel—one shriek, sparks, smoke and gone.
    Virginia Woolf (1882–1941)

    ... the time will come when no servant will be hired without a diploma from some training school, and a girl will as much expect to fit herself for house-maid or cook, as for dressmaker or any trade.
    Lydia Hoyt Farmer (1842–1903)