3 ms·
I think your `n * (n-1) / 2 + n` should be `n(n+1)(2n+1)/6` according to the SO article. `n * (n-1) / 2 + n` would be the sum of numbers, not sum of squares.
by zimpenfish 3y ago
I think your `n * (n-1) / 2 + n` should be `n(n+1)(2n+1)/6` according to the SO article.
`n * (n-1) / 2 + n` would be the sum of numbers, not sum of squares.
- eesmith 3y agoThank you for the correction!