Prove $\sum_{n \leq x} \tau (n) = 2(\sum_{n \leq \sqrt{x}} [\frac{x}{n}]) - [\sqrt{x}]^2$ Here $\tau(n)$ is the number of positive integers dividing $n$ and $[x]$ is the floor of $x$.
So I know if $n$ is not a perfect square, then half the positive integers dividing $n$ are less than $\sqrt{n}$, and the other half are greater than $\sqrt{n}$. Also, the amount of perfect squares that are less than or equal to $x$, is $[\sqrt{x}]^2$.
So let $d_n(k) = 1$ if $k|n$ and $d_n(k) = 0$ otherwise. Then
$\sum_{n \leq x} \tau (n) = \sum_{n \leq x} \sum_{k \leq n} d_n(k) = \sum_{n \leq x} 2(\sum_{k \leq \sqrt{n}} d_n(k) ) - [\sqrt{x}]^2 = 2(\sum_{n \leq x} \sum_{k \leq \sqrt{n}} d_n(k) ) - [\sqrt{x}]^2$.
So all I have to so is some how prove $\sum_{n \leq x} \sum_{k \leq \sqrt{n}} d_n(k) =\sum_{n \leq \sqrt{x}} [\frac{x}{n}]$

$$\begin{align}\sum_{n=1}^x\tau(n)&=\sum_{n=1}^x\#\{\,(a,b):ab=n\,\}\\
&=\#\{\,(a,b,n):ab=n\le x\,\}\\&
=\#\{\,(a,b):ab\le x\,\}\\&
=\#\{\,(a,b):ab\le x, a\le b\,\}+\#\{\,(a,b):ab\le x, a\ge b\,\}-\#\{\,(a,b):ab\le x, a= b\,\}\\&
=2\#\{\,(a,b):ab\le x, a\le b\,\}-\#\{\,(a,b):ab\le x, a= b\,\}\\&
=2\sum_{a\le\sqrt x}\#\{\,b:ab\le x, a\le b\,\}-\#\{\,a\mid a^2\le x\}\\&
=2\sum_{a\le\sqrt x}\left(\#\{\,b:ab\le x\,\}-\#\{\,b:ab\le x, a> b\,\}\right)-\#\{\,a\mid a^2\le x\}\\&
=2\sum_{a\le\sqrt x}\left(\left\lfloor\frac xa\right\rfloor-(a-1)\right)-\lfloor\sqrt x\rfloor\\&
=2\left(\sum_{a\le\sqrt x}\left\lfloor\frac xa\right\rfloor-\frac{\lfloor \sqrt x\rfloor(\lfloor \sqrt x\rfloor-1)}2\right)-\left\lfloor\sqrt 
x\right\rfloor\\
&=2\sum_{a\le\sqrt x}\left\lfloor\frac xa\right\rfloor-\left\lfloor\sqrt 
x\right\rfloor^2
\end{align}$$
