20. Let $A$ be the sum of all non-negative integers $n$ satisfying
$$
\left\lfloor\frac{n}{27}\right\rfloor=\left\lfloor\frac{n}{28}\right\rfloor .
$$

Determine $A$.
20. Answer. 95004
Solution. We shall prove that for any positive integer $a$, if $f(a)$ denotes the sum of all nonnegative integer solutions to $\left\lfloor\frac{n}{a}\right\rfloor=\left\lfloor\frac{n}{a+1}\right\rfloor$, then
$$
f(a)=\frac{1}{6} a\left(a^{2}-1\right)(a+2) .
$$

Thus $f(27)=95004$.
Let $n$ be a solution to $\left\lfloor\frac{n}{a}\right\rfloor=\left\lfloor\frac{n}{a+1}\right\rfloor$. Write $n=a q+r$, where $0 \leq r<a$. Thus $\left\lfloor\frac{n}{a}\right\rfloor=q$. Also $n=(a+1) q+r-q$. Since $\left\lfloor\frac{n}{a+1}\right\rfloor=q$, we have $0 \leq r-q$, that is, $q \leq r<a$. Therefore for each $q=0,1, \ldots, a-1, r$ can be anyone of the values $q, q+1, \ldots, a-1$. Thus
$$
\begin{aligned}
A & =\sum_{q=0}^{a-1} \sum_{r=q}^{a-1}(q a+r) \\
& =\sum_{q=0}^{a-1}(a-q) q a+\sum_{q=0}^{a-1} \sum_{r=q}^{a-1} r \\
& =a^{2} \sum_{q=0}^{a-1} q-a \sum_{q=0}^{a-1} q^{2}+\sum_{r=0}^{a-1} \sum_{q=0}^{r} r \\
& =a^{2} \sum_{q=0}^{a-1} q-a \sum_{q=0}^{a-1} q^{2}+\sum_{r=0}^{a-1} r(r+1) \\
& =a^{2} \sum_{q=0}^{a-1} q-a \sum_{q=0}^{a-1} q^{2}+\sum_{r=0}^{a-1} r^{2}+\sum_{r=0}^{a-1} r \\
& =\left(a^{2}+1\right) \cdot \frac{1}{2} a(a-1)+(1-a) \cdot \frac{1}{6} a(2 a-1)(a-1) \\
& =\frac{1}{6} a\left(a^{2}-1\right)(a+2) .
\end{aligned}
$$