Recall that Euler’s \(\phi(n)\) (totient) function is the number of residue classes (mod \(n\)) coprime to \(n\) or the number of positive integers \(\leq n\) that are relatively prime to \(n\). Computing the values of \(\phi(n)\) for \(n=1,2,\cdots,10\).
\(n\) | Residue Classes mod n (coprime to n) | \(\phi(n)\) |
---|---|---|
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 |
8 | 1, 3, 5, 7 | 4 |
9 | 1, 2, 4, 5, 7, 8 | 6 |
10 | 1, 3, 7, 9 | 4 |
Recall also that \(\phi(p)=p-1\) when \(p\) is prime. What about non-prime numbers? Recall \(\phi\) is a multiplicative function so for any \(m\) and \(n\),
This is actually due to the Chinese remainder theorem (TODO).
Now suppose that \(n\) is not prime and that
Then
So now what is \(\phi(p^i)\) for some power \(i\)? It is the number of integers coprime to \(p^i\). So we need to test all the numbers in \(\{0,\cdots,p^{i-1}\}\). But since \(p\) is prime, the number of integers not coprime to \(p^i\) are exactly those that are multiples of \(p\) so
We have \(p^i\) possible numbers less than or equal to \(p^i\), \(\{1,2,\cdots,p^i\}\). Out of these factors, there are exactly \(p^{i-1}\) numbers that are not coprime to \(p^i\). Therefore, the total number of numbers coprime to \(p^i\) is
Then
Alternative Explanation 1
Another way to think about Euler’s formula is using the inclusion exclusion principle. Take for example \(\phi(6)\). We start with 6 possibilities and then we have to throw away all the numbers divisible by 2
Then we have to throw away the numbers divisible so \(6\) so \(3\)
But now we have to add the numbers divisible by 6 back since we removed two copies of them because they are divisible by 2 and 3.
Let’s do \(\phi(30)\) now. We need take out all the numbers divisible by 2, 3 and 5 and then add the numbers taken out twice, \(2 \cdot 3 = 6\), \(3 \cdot 5 = 15\), \(2 \cdot 5 = 10\). But notice now that we’ve thrown 30 three times but we added it four times. We need to throw it away
The ones remaining coprime to \(30\) are \(\{1, 7, 11, 13, 17, 19, 23, 29\}\). The professor used a venn diagram which was nice (TODO).
Alternative Explanation 2: Probability
Take \(\phi(30)\) again. What is the probability that a number is coprime to \(30\)? This number is not coprime to \(30\) if
- Divisible by \(2\). The probability that a number is divisible by 2 is \(\frac{1}{2}\)
- Divisible by \(3\). The probability that a number is divisible by 3 is \(\frac{1}{3}\)
- Divisible by \(5\). The probability that a number is divisible by 5 is \(\frac{1}{5}\)
They key point is that these are independent events. Given two events \(A\) and \(B\). If these events are independent, then
For three events, we need
We want the probability that none of these three events occur. This is
But this is for all numbers. If we restrict this to numbers less than 30, then the number of numbers coprime to 30 is
Example
Compute \(\phi(10!)\). We need to compute the prime factorization of 10!. This is
Then
So as long as we know the prime factorization, then it is very easy to find out \(\phi(n)\).
Example
The prime factorization of \(24\) is
But for any \(n\), we know that
So we’re trying to factor out \(24\) as \(p^{e-1}(p - 1) \cdots\). But the factors of \(24\) are
So we need numbers \((p-1)\) that divide \(24\) but \(p\) itself is prime. In the list above, \(8\) divides \(24\) but \(8+1 = 9\) is not prime. So \(8\) can’t show up and can be eliminated. Similarly, \(3\) can be eliminated because \(3+1=4\) is not prime. We’ll end up with the following list
Consider \(p-1 = 12\). Then, \(p = 13\) and
But it is obvious here that \(e\) can’t be bigger than \(2\) since \(13^2 > 24\). So we can only have the powers \(0\) or \(1\) for 13. We can apply a similar logic to the remaining primes to see that we can only have the following powers
This is a pretty small list to iterate over and just brute force possible solutions. For example,
This means that \(n\) itself is \(13^1 \cdot 2^2 = 52\). Another choice is
This will give us \(n = 7 \cdot 2^3 = 56\) and so on.
Example: Carmichael's Conjecture
So far we know that the answer is yes and so far people have computed this for very large numbers with 10 billion digits. So if we were to find a counter example, it will be unbelievably huge. Observe now that if \(n\) is odd, then \(\phi(n) = \phi(2n)\). Why is that? because
We can use the same type of argument with divisibility rule to exclude more numbers but no one had ever proved it for all cases.
Example
Why do we care? Gauss showed that we can construct a regular \(n\)-gon with ruler and compass if and only if \(\phi(n)\) is a power of 2. (though constructing the \(n\)-gon with a ruler and compass is rather pointless). So we want
But now given that the prime factorization of \(n\) is
Then, using Euler’s formula
Notice that if \(p_i \neq 2\), then we must have \(e_i = 1\) (since if this wasn’t the case then \(\phi(n)=2^k\) will be divisible by a prime other than 2). So we should expect something like
So we will have some power of \(2\) multiplied by the remaining product. Observe that \((p_i - 1)\) must be a power of \(2\) since it divides \(\phi(n)=2^k\). So each of these \((p_i - 1)\) has the form
But now we know that \(p_i\) is a prime and since it has the form \(2^t + 1\), then it is a Fermat prime and \(t\) is a power of two itself. If we re-write \(n\), then
How big is \(\phi(n)?\)
We can also ask
The upper bound is pretty obvious. \(\phi(n) < n\). When \(p\) is prime, then \(\phi(n) = p-1\). So \(\phi(n)/n \leq 1\) can get very close to 1 since when \(n\) is prime.
How small can \(\phi(n)/n\) get? We know
where \(p_1,p_2,\cdots\) are the primes dividing \(n\). So to make this number smaller, we want \(n\) to be divisible by lots of small primes. Taking a few examples
But now, can we make \(\phi(n)/n\) as small as we like? for example less than \(\frac{1}{100}\)? To answer this, we want to know how small could the following number get
Could this number get smaller and smaller until it reaches zero or could there be some lower limit? We can figure this out by looking at its inverse (why its inverse? because sometimes it is easier to see big a number can get rather than how close it can get to zero). Then, taking the inverse
But now we can use the identity
To see that
Using the Euler product formula when \(s = 1\), then (TODO: what is this)
But this grows without bound. So this means that
goes to 0 so we can make it as small as we like
Average of \(\phi(n)/n\)
Another question we can ask is
We saw two extremes here. We saw that we can make \(\phi(n)/n\) go to zero by just adding many small prime factors. We also saw that can we make \(\phi(n)/n\) get very close to 1 just by choosing \(n\) to be prime. What about the average value of \(\phi(n)/n\)? We can think of this asking “What is the chance that a randomly chosen integer less than \(n\) is coprime to \(n\)?” or more general we can ask
The first issue is that we can’t really choose two numbers at random because this would mean that every integer is equally likely of being selected. This implies that every integer has the same chance of being selected, equal to some \(\epsilon\). This means \(\epsilon\) is zero. We can fix this if we have some upper bound \(N\) on \(m\) and \(n\). Furthermore, being coprime to each other means that they are both divisible by \(2\) for instance, so we can ask
The chance of having both numbers be divisible by \(2\) is
Therefore, the chance of having both not divisible by \(2\) is \(1-\frac{1}{4}\). Similarly, the chance of having both numbers not divisible by \(3\) is \(1 - \frac{1}{3^2}\) and so on. Then, the probability that \(m\) and \(n\) are coprime is about
Obviously there are issues here since if we limit \(m\) and \(n\) to some bound \(N\), then we need to stop testing after some limit. Also the chance of being divisible by \(3\) changes a tiny bit if we have an upper bound on both numbers. But, we ignore this for now to focus on whether the product above tends to zero or some other limit. Well, we saw before that
So we might think our product must also go to zero but in fact it doesn’t. To see why, we can take the inverse of the product to analyze it just like we did before so
So now at this step, multiplying all of these, we get all the numbers with prime factorization consisting of primes squared (and their powers). Therefore, this product gives
Euler managed to actually compute this sum and finding that it’s equal to
Generating Functions
TODO