Solving a problem, I needed a formula for $\Phi(n)=\sum_{k=1}^n \varphi(k)$, where $\varphi(k)$ is Euler's notorious totient function, that counts the number of numbers between $1$ and $k$ that are coprime with $k$. I looked it up online and found that the best we were able to get until now is $$\Phi(n)=\sum_{k=1}^n \varphi(k)=\frac{3}{\pi^2}n^2+\mathcal{O}\left(n(\log{}n)^{\frac{2}{3}}(\log\log{}n)^{\frac{4}{3}}\right)$$ which becomes, when calculating: $$\Phi(n)\simeq\frac{3}{\pi^2}n^2$$ and the error is quite small.
Howewer I needed an exact formula, and so, with some combinatorics and probability, I came up with the following: $$\Phi(n)=\sum_{k=1}^n \varphi(k)\simeq\left({n\choose 2}+1\right)\prod_{p\ prime}\left(1-\frac{1}{n^2}{\left\lfloor{\frac{n}{p}}\right\rfloor}^2\right)$$ The proof is simple but quite long, you can find it here: https://www.overleaf.com/read/xxjmgmcwqfgb.
For simplicity I will call the product function $L(n) \triangleq\left({n\choose 2}+1\right)\prod_{p\hspace{1pt}prime}\left(1-\frac{1}{n^2}{\left\lfloor{\frac{n}{p}}\right\rfloor}^2\right)$ from now on.
It is interesting to notice that the product taken over all prime is the same as the product taken only over the primes s.t. $p<n$, and this makes the calculation a lot easier.
Unfortunately (and I have no idea why), $L(n)$ still doesn't compute the exact value of $\Phi(n)$, but the error it provides is a lot smaller than the one of $\frac{3}{\pi^2}n^2$, here are some examples:
$$ \Phi(2064)=1\,295\,506\hspace{2cm}\Phi(2064)-L(2064)=58.0496 \hspace{2cm}\Phi(2064)-\frac{3}{\pi^2}2064^2=592.093 $$ the error with $L$ is $ 0.0044$ %, the error with $\frac{3}{\pi^2}n^2$ is $0.0457$ %.
$$ \Phi(10463)=33\,282\,718\hspace{2cm}\Phi(10463)-L(10463)=-8.35606 \hspace{2cm}\Phi(10463)-\frac{3}{\pi^2}10463^2=6500.06 $$ the error with $L$ is $ -2.51063 \cdot 10^{-5}$ %, the error with $\frac{3}{\pi^2}n^2$ is $0.0195298%$ %.
$$ \Phi(502)=76\,698\hspace{2cm}\Phi(502)-L(502)=0.0215688 \hspace{2cm}\Phi(502)-\frac{3}{\pi^2}502^2=97.9693 $$ where the error for $L$ is $2.81217 \cdot 10^{-5} $ %
I have no idea how to interpret these results. If someone knows why the formula fails I'd be delighted to hear.
EDIT:
As @Peter Košinár pointed out, the correct formula should be $$\sum_{k=1}^N \varphi(k)\simeq\ \frac{1}{2}\left(1+N^2\prod_{p\ prime}\left(1-\frac{1}{N^2}{\left\lfloor{\frac{N}{p}}\right\rfloor}^2\right)\right)$$