Project Euler 6: The Square of the Sum Minus the Sum of the Squares in O(1)
Square of the sum minus sum of squares for 1 to 100, loop-free via n(n + 1) / 2 and n(n + 1)(2n + 1) / 6, both derived by pairing and telescoping, plus integer-range notes and C++17/Python 3 code.
Project Euleralgorithmsmathseries