Test whether an integer is prime by trial division.
判断给定正整数是否为质数。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Definition of a prime | An integer greater than 1 with no positive divisors other than 1 and itself | Euclid, Elements, Book VII, Definition 11 |
| Trial division bound | It suffices to test divisors up to sqrt(n) | Knuth DE, The Art of Computer Programming, Vol. 2, §4.5.2 |
| Fundamental theorem of arithmetic | Every integer greater than 1 has a unique factorization into primes | Gauss CF, Disquisitiones Arithmeticae (1801) |
| Infinitude of primes | There are infinitely many primes (Euclid's proof) | Euclid, Elements, Book IX, Proposition 20 |