Константин обнови решението на 28.10.2016 11:03 (преди над 1 година)
+package main
+
+// SquareSumDifference finds the difference between the squares of the sum of the first n numbers and the sum of the squares of the first n numbers
+func SquareSumDifference(n uint64) uint64 {
+ var squareSum, sumOfSquares uint64 = 0, 0
+ for i := uint64(1); i <= n; i++ {
+ squareSum += i
+ sumOfSquares += i * i
+ }
+
+ squareSum = squareSum * squareSum
+ var result = squareSum - sumOfSquares
+ return result
+}