Closed form for number of tuple $(a,b,c)$ with $ab=c$, with integers $a,b,c\in[1,n]$ Somewhere I encountered this equality. 

The number of tuples $(a,b,c)$ where integers $a,b,c\in [1,n]$ such that $ab=c$ is equal to $$2\sum_{i=1}^{\lfloor\sqrt{n}\rfloor}\Big(\left\lfloor\frac ni\right\rfloor-i\Big)+\left\lfloor\sqrt{n}\right\rfloor$$

I tried to reduce this problem and observed that the number of such tuples is equal to the number of lattice points in the 1st quadrant under and on the hyperbola $xy=n$, excluding the points on the axes. Though it doesn't help me to solve the problem. Can anyone help to prove this, preferably using my observation or otherwise? 
 A: For such tuples with $a<b$, we need $a^2<ab\le n$, hence $$\tag1a<\sqrt n$$ and $b\le \frac na$. 
 However, our assumption $b>a$ strikes of the first $a$ of the possible values $1,2,\ldots, \lfloor\frac na\rfloor$ for $b$, i.e., there are only $$\tag2\left\lfloor \frac na\right\rfloor -a$$ possible values for $b$. Of course, each such choice of $a$ and $b$ leads to a unique $c$ and ultimately a valid triple.
So if we let $a$ run over all integers $\ge1$ and $<\sqrt n$, we count
$$ \sum_{a=1}^{\lceil\sqrt n\rceil -1}\left(\left\lfloor \frac na\right\rfloor -a\right)$$
triples with $a<b$. By symmetry, we count the same number of triples with $a>b$. Finally, we count $\lfloor \sqrt n\rfloor$ triples with $a=b$ (and hence $c$ any perfect square $\le n$). This leads us to a 
$$\tag3 2\sum_{i=1}^{\lceil\sqrt n\rceil -1}\left(\left\lfloor \frac ni\right\rfloor -i\right)+\lfloor\sqrt n\rfloor.$$
The difference to the desired formula is that the summation limit  $\lceil\sqrt n\rceil-1$ may differ from $\lfloor \sqrt n\rfloor$. However, this is only possible if $n$ is a perfect square, say $n=m^2$,  and in that case $\lceil\sqrt n\rceil-1=m-1=\lfloor \sqrt n\rfloor \;-1$, i.e., $(3)$ contains an additional summand for $i=m$. But as $\left\lfloor \frac nm\right\rfloor-m=0$, this additional summand does not matter and we conclude that $(3)$ can also be written as 
$$\tag4 2\sum_{i=1}^{\lfloor\sqrt n\rfloor}\left(\left\lfloor \frac ni\right\rfloor -i\right)+\lfloor\sqrt n\rfloor.$$
