Primality test

From TCS Wiki
Revision as of 14:10, 24 July 2017 by 2001:14ba:8fb:4e01:d470:fa10:ea04:9e09 (talk) (capitalization)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A primality test is a method (or algorithm) to find out if a certain number is a prime number. Cryptography uses prime numbers, and needs to test if a certain number is prime. The official proof of a prime is through its primality certificate.

Simple methods

  • Sieve of Eratosthenes: Determine if there is a number (between 2 and n, the number to test) that divides n, without a rest
  • Wilson's theorem (inefficient): [math]\displaystyle{ (p-1)! }[/math] evaluates to -1 mod p where p is the candidate prime number

Better methods

Template:Math-stub .