Problem:
Given $n$, Calculate $ \sum_{k=1}^{n} k\cdot \varphi(k) $
This is the oeis series.
My Thoughts:
Oeis gives a couple of approximate estimates/asymptotics but no real formula, exact closed form for this might not be possible. Any algorithm smarter than calculating $\varphi$ all $n$ times is welcome. My hunch says we might be fine with calculating $\varphi$ something of the order of $n^{1/2}$ times.
You can assume $O(n^{2/3})$ memory is available.
I am also thinking on the lines of reducing the problem to some combinations of $\sum_{i=1}^n \varphi(i)$ as I know a few efficient ways to calculate that
To summarise:
- Expected Time complexity: $O(n^{3/4})$ or better.
- Expected Space complexity: $O(n^{2/3})$ or better.