Last time we defined some new functions, and asked some questions about them.
More precisely, we let $\sigma_k(n)$ be defined as the sum of the $k$th power of the (positive) divisors of $n$, so: $$\sigma_k(n)=\sum_{d\mid n}d^k\, .$$ Recall that $\sigma_0$ was also called $\tau$, and is simply the number of divisors of $n$, while $\sigma_1$ is usually called $\sigma$ and is the sum of all divisors of $n$ (including $n$ itself!)
Here is where things stood in our experimentation, as conjectures.
We'll start today by actually proving the most important of these things, as well as mentioning a few other useful formulas.
Fact: If $p^e$ is a perfect prime power, then: $$\sigma_0(p^e)=e+1\text{ and }\sigma_1(p^e)=1+p+p^2+\cdots +p^e=\frac{p^{e+1}1}{p1}\; .$$
You'll note that this fact reduces to the formula already discovered when $p=2$.
There isn't much to prove here, once discovered. The only possible divisors of a prime power must have only that prime as divisors, by the FTA, so they are just other (smaller) powers of that prime, of which there are $e+1$, the ones summed up in the $\sigma_1$ formula. The fraction formula is just the usual geometric summation formula familiar from precalculus and calculus.
More difficult is proving the following.
Fact: For any $i$, $\sigma_i(n)$ is multiplicative, in the sense that $$\sigma_i(mn)=\sigma_i(m)\sigma_i(n)\text{ when }gcd(m,n)=1\; .$$
This would automatically lead to formulas like the following: $$\text{If }n=p_1^{e_1}p_2^{e_2}\cdots p_k^{e_k}\; ,\text{ then}$$ $$\sigma_0(n)=\prod_{i=1}^k\left(e^i+1\right)\text{ and }\sigma_1(n)=\prod_{i=1}^k\left(\frac{p_i^{e_i+1}1}{p_i1}\right)\; .$$
I will not prove this directly! Instead, we will prove a theorem that exemplifies the fact that, in the long run, it is better to prove general lemmas for sums of arithmetic functions than to do each one by itself. Otherwise we do an endless line of proofs like the ones we did for $\phi$, but for every arithmetic function.
Let $\sum_{d\mid n}$ be a sum over all positive divisors (including $1$ and $n$) of $n$. Then we have the following.
Theorem:
If $g$ is multiplicative and $f(n)$ is defined as $$f(n)=\sum_{d\mid n}g(d)$$ then $f$ is also multiplicative.
Proof:
Luckily, this will be easier than proving the same for Euler's $\phi$ function.
Let $m$ and $n$ be coprime; we are interested in $f(mn)$. Basically, this all boils down to asking what the divisors of $mn$ look like. Any divisor of $mn$ must be the product of some divisor $a$ of $m$ and some divisor $b$ of $n$; this is just about multiplication and divisibility, not even coprimeness. But that guarantees that $a$ and $b$ are coprime as well.
So each divisor $d\mid mn$ gives us a (unique) pair of divisors $a$ and $b$ of $m$ and $n$. So instead of summing over all divisors of $mn$, we can instead sum over each divisor of $n$ for each divisor of $m$. In symbols, $$f(mn)=\sum_{a\mid m}\sum_{b\mid n}g(ab)\; .$$ Now we can use all the facts we have at hand  coprimeness, multiplicativity, etc.  to finish it off: $$f(mn)=\sum_{a\mid m}\sum_{b\mid n}g(ab)=\sum_{a\mid m}\sum_{b\mid n}g(a)g(b)$$ $$=\left(\sum_{a\mid m}g(a)\right)\left(\sum_{b\mid n}g(b)\right)=f(m)f(n)\; , \text{ Q.E.D.}$$
Corollary:
Since $g(n)=n^i$ is clearly multiplicative, it is true that $$\sum_{d\mid n}g(d)=\sum_{d\mid n}d^i=\sigma_i(n)$$ is also multiplicative.
Since we'll use them later, we define $u(n)=1$ to be the unit function and $N(n)=n$ to be the identity function; these are the special cases $i=0$ and $i=1$ of the corollary, which show that $\sigma_0$ and $\sigma_1$ are multiplicative.
For the rest of today, we will focus on $\sigma_1=\sigma$ itself, since the sum of divisors function has a deep richness of its own.
Click to the left again to hide and once more to show the dynamic interactive window 
As you manipulate the Sagelet above, try to see what possibilities there are for the relative size of $\sigma(n)$ with respect to $n$ itself. (Or, one can ask what the constant $C_n$ is such that $\sigma(n)=C_n\cdot n$.)
Quite a few certainly are above and below $2$. If you look carefully, you will see that only one of the numbers above has a sum of divisors without 1 or 2 as the integer part. What is it?
Another thing we can do is take big powers of numbers with lots of small prime divisors (and hence lots of factors). Such numbers might get us big ratios.
Click to the left again to hide and once more to show the dynamic interactive window 
You'll notice that although we quickly go above 3, but don't seem to get much further. Why?
A helpful thing to think about with this is the following rewrite, using the formula for $\sigma(n)$: $$\frac{\sigma(n)}{n}=\frac{\prod_{i=1}^k \left(\frac{p_i^{e_i+1}1}{p_i1}\right)}{\prod_{i=1}^k p_i^{e_i}} = \prod_{i=1}^k\frac{p_i1/p_i^{e_i}}{p_i1} \approx \prod_{i=1}^k\frac{p_i}{p_i1}\, ,$$ and we should expect this approximation to be very close when $e_i$ are all quite large. So the idea is that since $\frac{p}{p1}>1$, if we multiply by enough of these we will get very large numbers and so $\sigma(n)/n$ will be greater than any given $C$, and then $\sigma(n)>Cn$.
Of course, $p=2$ is the best for this since $\frac{2}{21}=2$, but the others will hopefully be useful. For instance, $n=2^{10} 3^{10}$ will have $$\sigma(n)/n=\frac{21/2^{10}}{21}\frac{31/3^{10}}{31} \approx \frac{2}{21}\frac{3}{31}=3$$ so certainly $\sigma(6^{10})$ will be nearly $3\cdot 6^{10}$.
If we multiply it by 5 as well that should do it, and that gives the results we saw in the previous cell. $$\frac{21/2^{10}}{21}\frac{31/3^{10}}{31}\frac{51/5}{51}\approx\frac{2}{21}\frac{3}{31}\frac{5}{51}=2\cdot \frac{3}{2}\cdot \frac{5}{4}=\frac{15}{4}=3.75\; .$$
2.99851822943128 3.59822187531753 2.99851822943128 3.59822187531753 
4.13 4.13 
10.9 10.9 
Continuing this for more primes suggests the following fact.
Fact: For any positive $C$, there is a positive integer $n$ such that $$\sigma(n)>Cn\; .$$
The argument above not completely rigorous, but good enough for now. It turns out that trying to prove it this way could bring the distribution of primes to the table. Later we might see a more formal proof.
Now let's look for a moment at the perfect number question. We recall from last time's homework that when this ratio is exactly $2$, we say $n$ is a perfect number.
This definition goes back quite a ways. Euclid defines it at the beginning of his numbertheoretic books, and only mentions it again over one hundred propositions later, where he proves that certain numbers are, in fact, perfect  a fitting end, as Dunham says in Journey through Genius.
Theorem:
If $n$ is a number such that $2^n1$ is prime, then the (even) number $2^{n1}\left(2^n1\right)$ is perfect.
Euclid's proof of this is worth looking at, in fact.
Many centuries later, Euler proved the converse.
Theorem:
If $n$ is an even perfect number, it is the product of a power $2^{n1}$ and a prime $2^n1$.
Notice that these primes are precisely the Mersenne primes we discussed on Day 20!
Proof:
First, assume that $2^n1$ is prime. Then the factors of $2^{n1}\left(2^n1\right)$ are coprime, so $$\sigma\left(2^{n1}\left(2^n1\right)\right)=\sigma\left(2^{n1}\right)\sigma\left(2^n1\right)=\left(2^n1\right)\left(2^n1+1\right)$$ The steps are because of multiplicativity and the formulas we had above for $\sigma$ of powers of two and primes. But then $$\left(2^n1\right)\left(2^n1+1\right)=2^n\left(2^n1\right)=2\left[2^{n1}\left(2^n1\right)\right]$$ so that the sum of divisors is exactly twice the original number.
Now for the converse, which is somewhat longer.
If we have an even perfect number, then it is divisible by some power of two. Let us (looking ahead!) call this the $n1$th power! So that our even perfect number is $2^{n1}q$, where the $q$ is the (odd) quotient. Let's divide the rest of the proof into steps.
We will leave the question about whether there are odd perfect numbers to another day.
There are many things people have claimed about numbers of this type. A Hellenistic Roman in the first century in Gerasa (the same place as the story of the demons called "Legion" who went into swine) named Nichomachus claimed that the $n$th perfect number had $n$ digits.
He was more concerned with mystical claims about them (which many repeated), but this assertion continued to be made for over a thousand years; however, knowing what we do about Mersenne primes, we see that the fifth one is 13, so that the next perfect number, $$\left(2^{13}1\right)\cdot 2^{12}\, ,$$ lay mysterious for a long time. It was apparently discovered in the fifteenth century.
33550336 33550336 
Until the early modern period, such numbers were basically inaccessible.
It turns out that number theorists (often of the amateur variety, but certainly not always) have come up with all kinds of other names for similar things related to $\sigma(n)/n$.
These are all fairly standard terminology. There are other ones that are less wellknown, but nonetheless interesting.
One other interesting idea is that of amicable numbers, such that $\sigma(n)=\sigma(m)=m+n$. Clearly any perfect number is amicable with itself. The smallest pair of unequal amicable numbers is $(220,284)$; this was known to the ancient Greeks, cherished by some medieval Muslims, and apparently was not improved upon until the modern numbertheoretic era. Fermat, Descartes, and Euler all worked with this and found large examples, but it turns out that the next smallest pair was found by a sixteenyear old Italian boy in 1860!
2394 2394 2394 2394 2394 2394 
Apparently he came up with this by trial and error, though no one knows for sure. Here is some of the most current data on these pairs.
There is a way to get as many amicable pairs as you like, discovered by Ibn Qurra and (later) Fermat, and used by Euler.
Since only primes and powers of two are involved, it's easy to calculate $\sigma$ in this case, so proving it is left as an exercise.
Click to the left again to hide and once more to show the dynamic interactive window 
From now on, we will refer to $\sigma_0$ as $\tau$, just as we refer to $\sigma_1$ as $\sigma$.
Homework:
