Why is the average number of divisors of the first $N$ natural numbers approximately $\log(N)$?

149 Views Asked by At

In the textbook An Illustrated Theory of Numbers, the following problem appears:

enter image description here

I wrote up some Sage code to confirm this:

   def divisors(x):
    l = []
    for n in range(1,x+1):
        if x%n == 0:
            l.append(n)
    return len(l)


def sum_divisor_up_to_k(k):
    l = []
    for n in range(1,k+1):
        l.append(divisors(n))
    return sum(l)

def Average_up_to_j(j):
    return (sum_divisor_up_to_k(j)/j)


errors = [ abs(Average_up_to_j(x)-log(x).n()) for x in range(10,100) ]


for error in errors:
    print(error, '\n')

And lo and behold, the textbook is right about this. Their difference approaches zero. I am both surprised and amazed this is the case.

Why should $NA(N)$ approach $\log(N)$ as $N$ approaches infinity, and how is this picture helpful?

1

There are 1 best solutions below

0
On BEST ANSWER

You can proceed as follows:

\begin{align*} NA(N) = \sum_{n\leq N} \sigma_0(n) &= \sum_{n\leq N} \sum_{d\leq N} \mathbf{1}[\text{$d$ divides $n$}] \\ &= \sum_{d\leq N} \sum_{n\leq N} \mathbf{1}[\text{$n$ is a multiple of $d$}] \\ &= \sum_{d\leq N} \left\lfloor \frac{N}{d} \right\rfloor. \end{align*}

In order to estimate the last sum, we invoke the following inequality:

$$ \int_{d}^{d+1} \frac{N}{x} \, \mathrm{d}x - 1 \leq \left\lfloor \frac{N}{d} \right\rfloor \leq \int_{d-1}^{d} \frac{N}{x} \, \mathrm{d}x $$

Summing the first inequality for $1 \leq d < N$ and the second one for $1 < d \leq N$, we get

$$ N \log N - N + 2 \leq NA(N) \leq N \log N + N. $$

Dividing both sides by $N$ proves the desired claim.


Remark. Writing

$$ A(N) = H_N - \sum_{d\leq N} \left\{ \frac{N}{d} \right\} \frac{1}{N} $$

and noting that $\sum_{d\leq N} \left\{ \frac{N}{d} \right\} \frac{1}{N} \to \int_{0}^{1} \left\{\frac{1}{x}\right\} \, \mathrm{d}x = 1 - \gamma$, we can also obtain a better estimate

$$ A(N) = \log N + 2\gamma - 1 + o(1) $$

as $N \to \infty$.