Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Thank you for the correction!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: