Project Euler #6: Sum square difference

  • + 0 comments

    Had to look up some formulas and do some algebra.

    long ans = n * (n + 1) * (3 * n + 2) * ( n - 1) / 12;