Section 5.4 Some Contributions of Fermat
Though we all seem to remember Pierre de Fermat for his "Last" theorem, he did much more than just scribble notes in the margins of books. In fact, Fermat was one of the last great mathematicians to pursue mathematics as an aside to his normal life; he was a lawyer and magistrate. Due to this he is known as the "Prince of Amateurs." In this lecture we will discuss some of the mathematics behind the man.
Section 5.4.1 Factoring Integers
With this theorem in mind Fermat figured out a way to factor an integer, that is usually quicker than the method in the application above.
Since powers of two are easy to factor, let us assume that \(n\) is odd. Fermat noticed that finding a factor of an odd integer \(n\) is equivalent to finding an integer solution to
If this is the case, then
and conversely if \(n=ab\) where \(a\geq b\geq 1,\) then
To start the search for factors of \(n,\) we notice that the equation \(n =x^2-y^2\) is equivalent to
So we find the smallest \(k\) for which \(k^2\geq n,\) and look at the numbers
until a value \(m\geq\sqrt{n}\) is found making \(m^2-n\) a square. We know the process ends since
which corresponds to the factorization \(n = n\cdot 1.\)
Remark 5.4.1.
Fermat used this method to factor
in \(11\) steps, compared to doing \(4580\) divisions by odd primes up to \(44021.\)
This method gets more effective if there are two factors close to \(\sqrt{n}.\)
Example 5.4.2.
Let \(n = 23449.\) The smallest square exceeding \(n\) is \(154^2,\) so we have
so that
If we used the odd prime division way to find a factorization, it would have taken, \(\pi(131) = 32\) divisions.
Section 5.4.2 Fermat's Little Theorem
This is another of Fermat's many contributions, which again he did not prove (to our knowledge). He wrote in a letter to Frénicle dated October 18, 1640, "I would send you a demonstration, if I did not fear its being too long." Again, it would be almost 100 years before Euler, in 1736, would give the first proof of Fermat's Little Theorem.
Theorem 5.4.1 (Fermat's Little Theorem).
Let \(p\) be a prime and suppose that \(p\nmid a.\) Then
Proof.
To show this, let \(p\) be a prime, \(a\in\mathbb{N},\) and \(p\nmid a.\) Consider the multiples of \(a,\)
None of these are congruent modulo \(p,\) since if \(ra\equiv sa \pmod{p}\) with \(0\leq r\lt s\lt p-1,\) then \(r\equiv s\pmod{p}\) so that \(p\vert r-s,\) which is impossible.
Thus the set of integers in the above list is congruent modulo \(p\) to the set \(1, 2,..., p-1,\) so that
Since \(\gcd((p-1)!, p) = 1\) we may cancel \((p-1)!\) from each side to give \(a^{p-1}\equiv 1\pmod{p}.\)
Corollary 5.4.2.
Let \(p\) be a prime. Then
Proof.
If \(p\vert a\) the statement holds trivially. If \(p \nmid a,\) then Fermat's Little Theorem gives \(a^{p-1} \equiv 1 \pmod{p},\) so that multiplication on each side by \(a\) gives the desired result.
Corollary 5.4.3.
If \(p\neq q\) are primes with \(a^p\equiv a\pmod{q}\) and \(a^q \equiv a\pmod{p},\) then \(a^{pq} \equiv a\pmod{pq}.\)
Proof.
By the previous corollary \((a^q)^p \equiv a^q \pmod{p}.\) Since, by hypothesis, \(a^q \equiv a\pmod{p},\) we have \(a^{pq} \equiv a\pmod{p}\) so that \(p\vert a^{pq}-a.\) Similarly \(q\vert a^{pq}-a\) so that since \(\gcd(p, q) = 1\) we have \(pq\vert a^{pq}-a\) and so \(a^{pq} \equiv a\pmod{p}.\)
Remark 5.4.4.
Fermat's Little Theorem can be used as a test for non-primality. Suppose you have a number \(n,\) and you wish to know if \(n\) is not prime. If
then \(n\) is not prime.
Example 5.4.5.
Consider \(n = 117,\) then
and \(2^7 = 128 \equiv 11 \pmod{117}.\) So
so \(117\) is not prime.
Unfortunately this test cannot be used to show a number is prime. In fact, there are composite numbers \(n\) for which \(2^n\equiv 2 \pmod{n}.\) These are special.