Compare $\sum_{k=1}^n \left\lfloor \frac{k}{\varphi}\right\rfloor$ ... Given two integer sequences
\begin{equation*}
\displaystyle A_n=\sum_{k=1}^n \left\lfloor \frac{k}{\varphi}\right\rfloor ,
\end{equation*}
\begin{equation*}
B_n=\left\lfloor\dfrac{n^2}{2\varphi}\right\rfloor-\left\lfloor \dfrac{n}{2\varphi^2}\right\rfloor
\end{equation*}
here: $\quad\varphi=\dfrac{1+\sqrt{5}}{2}\quad$ (golden ratio)
Prove that: $|A_n-B_n|\leq 1.$

I realized that the difference between $A_n$ and $B_n$ is very small but the failure in finding an exact formula for $A_n$
Could you help me?

I can prove less; we have $$\frac {n^2 + n} {2 \varphi} - n < A_n \leqslant \frac {n^2 + n} {2 \varphi}$$ and  $$\frac {n^2 - n/\varphi} {2 \varphi} - \frac {1} {2} < B_n \leqslant \frac {n^2 - n/\varphi} {2 \varphi}.$$ It follows that $$\frac {n (\varphi + 1 - 2 \varphi^2)} {2 \varphi^2} < A_n - B_n < \frac {(\varphi + 1) n} {2 \varphi^2} + \frac {1} {2}.$$ That is, we have $$- \frac {n} {2} < A_n - B_n < \frac {n + 1} {2}$$
