Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does $\displaystyle\sum_{i=1}^n\left\lfloor\dfrac{n}{i}\right\rfloor^2$ admit a closed form expression?

share|cite|improve this question
I have changed the formatting of the title so as to make it take up less vertical space -- this is a policy to ensure that the scarce space on the main page is distributed evenly over the questions. See here for more information. Please take this into consideration for future questions. Thanks in advance. – Lord_Farin Jun 7 '13 at 18:22
Sure and thanks :) – Maazul Jun 7 '13 at 18:25
Unlikely; see the related – vadim123 Jun 7 '13 at 18:47
up vote 8 down vote accepted

To see how the first term in the asymptotic expansion is obtained, put $$a(n) = \sum_{k=1}^n \bigg\lfloor \frac{n}{k} \bigg\rfloor^2$$ and note that $$a(n+1)-a(n) = 1 + \sum_{k=1}^n \left(\bigg\lfloor \frac{n+1}{k} \bigg\rfloor^2 - \bigg\lfloor \frac{n}{k} \bigg\rfloor^2\right) \\= 1 + \sum_{d|n+1 \atop d<n+1} \left(\left(\frac{n+1}{d}\right)^2 - \left(\frac{n+1}{d}-1\right)^2\right) = \sum_{d|n+1} \left(2\left(\frac{n+1}{d}\right)-1\right) \\= 2\sigma(n+1)-\tau(n+1).$$

It now follows that $$a(n) = 2\sum_{k=1}^n \sigma(k) - \sum_{k=1}^n \tau(k) = \sum_{k=1}^n \left(2\sigma(k)-\tau(k)\right).$$ We can apply the Wiener-Ikehara theorem to this sum, working with the Dirichlet series $$L(s) = \sum_{n\ge 1} \frac{2\sigma(n)-\tau(n)}{n^s} = 2\zeta(s-1)\zeta(s)-\zeta(s)^2.$$ We have $$\operatorname{Res}(L(s); s=2) = \frac{\pi^2}{3},$$ so that by the aforementioned theorem, $$a(n) \sim \frac{\pi^2/3}{2} n^2 = \frac{\pi^2}{6} n^2.$$ In fact we can use Mellin-Perron summation to predict, but not quite prove, the next terms in the asymptotic expansion, getting $$a(n) = \left(\sigma(n)-\frac{1}{2}\tau(n)\right) + \frac{1}{2\pi i} \int_{5/2-i\infty}^{5/2+i\infty} L(s) n^s \frac{ds}{s}$$ which yields $$a(n) \sim \left(\sigma(n)-\frac{1}{2}\tau(n)\right) +\frac{\pi^2}{6} n^2 - (\log n + 2 \gamma)n - \frac{1}{6}.$$ This approximation is quite good, giving $16085.71386$ for $n=100$ when the correct value is $16116$ and $1639203.715$ for $n=1000$ when the correct value is $1639093.$

share|cite|improve this answer

This is A222548 in the online encyclopedia of integer sequences. They don't provide a closed form, but they do give the following:

$$a(n)\approx\frac{\pi^2}{6}n^2+O(n\log n)$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.