6. Primes
Prime numbers are those, roughly speaking, which don’t have nontrivial factors. Here is the formal definition:
6.1 Definition: prime number
A positive integer $n$ is a prime if and only if it is greater than 1 and its only positive factors are 1 and $n$. Numbers bigger than 1 which are not primes are called composite numbers.
6.1.1 Example The first few primes are $2,3,5,7,11,13,17,\ldots$.
6.1.2 Example 0 and 1 are not primes.
6.1.3 Worked Exercise Let $k$ be a positive integer. Prove that $4k+ 2$ is not a prime.
Answer $4k+2=2(2k+1)$ Thus it has factors $1,2,2k+1$ and $4k+ 2$. We know that $2\neq 4k+ 2$ because $k$ is positive. Therefore $4k+ 2$ has other positive factors besides 1 and $4k+ 2$, so $4k+ 2$ is not prime.
6.1.4 Exercise Prove that any even number bigger than 2 is composite.
6.1.5 Exercise Which of these integers are prime and which are composite? Factor the composite ones: 91, 98, 108, 111. (Answer on page 243.)
6.1.6 Exercise Which of these integers are prime and which are composite? Factor the composite ones: 1111, 5567, 5569.
6.1.7 Exercise Prove that the sum of two odd primes cannot be a prime.
6.2 Primes in Mathematica
The command PrimeQ determines if an integer is prime (it is guaranteed to work for $n<2.5\times 10^{10}$). Thus PrimeQ[41] will return True and PrimeQ[111] will return False.
The command Prime[n] gives the $n$th prime in order. For example, Prime[1] gives 2, Prime[2] gives 3, and Prime[100] gives 541.
6.2.1 Exercise (Mathematica) Find all the factors of your student number.
Page 10 of the book (PDF).