You are viewing a single comment's thread. Return to all comments →
Had to look up some formulas and do some algebra.
long ans = n * (n + 1) * (3 * n + 2) * ( n - 1) / 12;
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #6: Sum square difference
You are viewing a single comment's thread. Return to all comments →
Had to look up some formulas and do some algebra.