Infinitely Many Primes With Last Digit 1
Before discussing Euler’s theorem, recall Fermat’s Theorem from the lecture 09
We will use it to show that there are infinitely many primes with last digit equal to 1. For example
We can show that this sequences goes on forever. This is in fact a special case of Dirichlet’s theorem which says if we have an arithmetic progression, then there are infinitely many primes in that progression. Here, we will focus on the special case of primes of the from \(10m+1\). First, it is easy to show that there are infinitely many primes of the form \(5n+1\) because \(5\) is a prime here.
Proof: let \(N = a^q - 1\) where \(q\) is prime. We’re going to analyze the prime factors that divide \(N\). So suppose \(p \mid N\) where \(p\) is prime. Since \(p\) divides \(q^q - 1\), then
Let the order of \(a \pmod{p}\) be \(o(a)\). By lecture 10, \(o(a)\) must divide \(q\). But \(q\) is prime, so \(o(a)\) either 1 or \(q\).
Case 1: \(o(a) = 1\). Then
Case 2: The order is \(q\). By Fermat we know that \(a^{p-1} \equiv 1 \pmod{p}\). This implies that \(q\) must divide \(p-1\). Therefore
This condition almost gets us the primes of the form that we want. Why? because this implies that
However, condition one though allows primes \(p\) such that \(p \mid a - 1\), so they are not necessarily of the form that we want so we must eliminate case 1. To do so, instead of defining \(N = a^q - 1\), let \(N\) be
and assume that \(p \mid \frac{a^q - 1}{a - 1}\). This this also means that \(p \mid a^q - 1\). Therefore, we will have the same cases for the order of \(a \pmod{p}\). Recall that in case 1, we had \(a \equiv 1 \pmod{p}\). Also observe that
Taking \(\bmod p\), then
But since \(a \equiv 1 \pmod{p}\), then
But also by assumption \(p \mid \frac{a^q - 1}{a - 1}\) so \(\frac{a^q - 1}{a - 1} \equiv 0 \pmod{p}\). So combining the following
But this just means that \(q \equiv 0 \pmod{p}\) so \(q \mid p\). But \(q\) and \(p\) are both primes. This means that we must
Case 2: we showed that \(p \equiv 1 \pmod{q}\) which meant that \(p\) has the form
Finally, we saw that any prime \(p \mid N\) must satisfy either:
- \(p \mid a - 1\), in which case we showed that \(p = q\)
- \(p \equiv 1 \pmod{q}\)
However, suppose we pick \(a\) such that \(q \mid a\). This means that \(a \equiv 0 \pmod{q}\). In other words, \(a \not\equiv 1 \pmod{q}\) and
But in case 1, \(p = q\). So \(p \not\mid a-1\). That’s impossible. So \(p\) must be of the form in the second case. There are infinitely many integers \(a\) of the form \(q \mid a\). Therefore, there are infinitely many primes of the form \(p = qn + 1\) for some integer \(n\). \(\ \blacksquare\)
Primes of the form \(5n + 1\)
Let’s fix \(q = 5\) and let’s see how this will work. So now \(N\) will be
So now suppose \(p \mid N\). We show that either
- \(p \equiv 1 \pmod{5}\) which means \(p = 1 + 5n\) OR
- \(x \equiv 1 \pmod{p}\)
The second condition meant that
But by assumption, \(p \mid x^4 + x^3 + x^2 + x + 1\). Therefore, \(p \mid 5\). If we pick \(x\) such \(5 \mid x\), then \(x \equiv 0 \pmod{5}\). In other words, \(x \not\equiv 1 \pmod{5}\). So \(5 \not\mid x - 1\). But in case 1, we had \(p \mid x - 1\). This is impossible since in case 1, \(p = q\). So we must fall in case two where \(p = 5n + 1\). So let’s plug in 5, then
We can see that \(11 = 2 \cdot 5 + 1\) and \(71 = 14 \cdot 5 + 1\). Let’s plug in 2, then
Primes of the form \(10n + 1\)
So now we’re back to wanting to show that
So 10 is not prime in this case but suppose that we fix \(q\) again to be 5. Now let \(N\) be
So now let \(p\) be any prime dividing \(N\). \(x\) is the product of all the primes we already now. Then \(p\) will see that
- \(p \equiv 1 \pmod{10}\) which means \(p = 1 + 10n\). Note that \(p\) can't be 2 or 5 since we have a factor of 2 and 5 pushed in each term.
- \(x\) can't be a known prime.
Euler's Theorem
Now we will look at Euler’s Theorem is a generalization of Fermat’s Theorem. We want to study powers of \(a\) module \(m\). So we can look at the function
So suppose that \(m = 12\) and \(x \rightarrow 2x\). Notice here that when we take \(x\) to be powers of 2 so \(2, 2^2, 2^3, 2^4, ...\), then
So we created a loop. Particularly, we see that \(2^2 \equiv 2^4 \equiv 2^6 \pmod{12}\) for example. So this means that
We have an infinite number of powers and we have a finite number of values modulo \(m\) so by the pigeonhole principle, two of them are equal. But now suppose that \((a,m)=1\). Then \(a\) is invertible module \(m\). In this case
So this implies that
Now what Euler did was that he identified what this \(x\) power is. Before stating Euler’s theorem, let’s do an example
Take \(m = 13\) and \(a = 5\). Let’s look at powers of \(a\) module \(m\)
So let’s multiply this sequence by \(2\) module \(m\). We will see that
Multiplying again by 2 module \(m\)
Observations:
- Multiplying by 2 gives us a cycle every time.
- Multiplying the first cycle by 2 module 13 resulted in a new cycle of the same length that is disjoint from the current one.
- All these sequences are disjoint cycles of length 4.
- The total number of integers invertible module 13 is 12 and they appear in three disjoint cycles above \(\{5,12,8,1\},\{10,11,3,2\},\{7,9,6,4\}\)
We get these disjoint cycles because first \(a\) is invertible module 13. So there isn’t a chance we would get \(5^k \equiv 0 \pmod{13}\) for any \(k\). Additionally, the number we’re multiplying the cycles with is 2. 2 is also invertible module 13. So again we won’t see \(2^r \cdot 5^k \equiv 0 \pmod{13}\) for any \(r\).
Recall that the order of \(5 \pmod{13}\) is the smallest positive integer \(k\) such that \(5^k \equiv 1 \pmod{13}\).
There are 12 numbers coprime to 13. The function that counts the numbers coprime to a given number is called Euler’s function.
These numbers form a disjoint union of cycles just like we saw. Each cycle’s length is exactly the order of \(5\). So the order of 5 must divide the total number of numbers coprime to 13 or \(\phi(13)\). Since the order divides \(\phi(13)\), then \(a^{\phi(13)}\) must also be congruent to 1 module 13. This is Euler’s Theorem. It is stated as
A special case of this theorem is Fermat’s theorem where \(m\) is prime. In this case \(\phi(m) = m-1\) and we have \(a^{m-1} \equiv 1 \pmod{m}\). (TODO: Do Euler’s original proof)
Side note: In Group Theory, we know that the group of numbers coprime to 13 is the multiplicative group \(\Phi(13)\). This group contains exactly 12 elements. The order of each element \(a\) is the exactly the size of the cyclic subgroup \(\langle a \rangle\). The order of \(a\) by Lagrange’s Theorem must divide the order of the group.
Example
Take \(m = 1,2,3,4...,12\). Let’s look at the numbers co-prime to \(m\) so
\(m\) | Numbers Coprime to \(m\) | \(\phi(m)\) |
---|---|---|
1 | 1 | 1 |
2 | 1 | 1 |
3 | 1, 2 | 2 |
4 | 1, 3 | 2 |
5 | 1, 2, 3, 4 | 4 |
6 | 1, 5 | 2 |
7 | 1, 2, 3, 4, 5, 6 | 6 |
Notice here for any row like row 6, each element’s order must divide \(\phi(m)\) so 5 has order 2 which divides 2. For row 7, 2 has order 3 which divides 6. Observe too, that in each row, there is always an element which has order equal to \(\phi(m)\). For example for row 7, 3 has order 6 for example. So for these examples (row 1 to 7), \(\phi(m)\) is the smallest exponent such that for whatever element coprime to \(x\), we have that \(x^{\phi(m)} \equiv 1 \pmod{m}\). However, let’s take a look at row 8:
\(m\) | Numbers Coprime to \(m\) | \(\phi(m)\) |
---|---|---|
8 | 1, 3, 5, 7 | 4 |
9 | 1, 2, 4, 5, 7, 8 | 6 |
10 | 1, 3, 7, 9 | 4 |
Observe now that when \(m = 8\), there are 4 elements coprime to 8 but each element’s order is 2. None of the elements have order 4. So for any \(x\) coprime to 8, \(x^2 \equiv 1 \pmod{8}\). However \(\phi(8) = 4\). So \(\phi(8)\) is not the smallest possible exponent.
If an element has order equal to \(\phi(m)\), this element is called a primitive root.
So for \(m = 8\) for example, we don’t seem to get any primitive roots. In a later lecture, we will examine the numbers \(m\) that do have primitive roots.
Take now, \(m = 30\). The numbers coprime to 30 are \(1, 7,11,13,17,19,23,29\). 8 numbers so \(\phi(30) = 8\). By Euler,
So now is \(8\) the smallest possible exponent such that \(x^8 \equiv 1 \pmod{30}\)? No, it’s not and we don’t need to check the individual orders to verify this. Observe that
Therefore, by the Chinese remainder theorem
Example
To get the last two digits of a number, we want to take this number module 100. Observe that \(\phi(100) = 40\) by simply noting that the last digit of a number coprime to 100 must either be 1, 3, 7 or 9. Using Euler’s Theorem, then we know that
Then
So the last two digits of \(7^{403}\) are 43.
Example
To get the last digit of a number, we want to take this number module 10. Observe that \(\phi(10) = 4\). Then by Euler’s Theorem
Side note: before continuing, let’s take a look at
Hitting 1 is special because now if we multiply both sides by \(a\), we get
if we continue, we get the remainders \(1, a, a^2, ... a^k\). In fact, if we multiply \(a^k\) then
So the thing that Euler showed is that we are guaranteed to have \(a^{k} \equiv 1 \pmod{m}\) happen if \((a,m)=1\).
So now back to the question, since \(7^4 \equiv 1 \pmod{10}\), then
So let’s suppose we have some exponent \(k\), then \(4k = 4q + r\) by the division algorithm where \(0 < r < 4\). Then
Therefore
Thus
So what it \((7^{7^7} \bmod 4)\)? We know that
Then
To compute \(3^{7^7} \bmod 4\), we can use Euler again. We know \(\phi(4) = 2\). By Euler’s Theorem
Therefore
So now what is \(7^7 \pmod{2}\)? 7 is odd so any power of 7 will be odd. Therefore, \(7^7 \equiv 1 \pmod{2}\). Substituting back
Substituting back again