package diffsquares import "math" // SquareOfSums calculates the Square of the sums // of the first 'num' natural numbers func SquareOfSums(num int) int { ret := 0 for num > 0 { ret += num num-- } return int(math.Pow(float64(ret), 2)) } // SumOfSquares calculates the Sum of the Squares // of the first 'num' natural numbers func SumOfSquares(num int) int { ret := 0 for num > 0 { ret += int(math.Pow(float64(num), 2)) num-- } return ret } // Difference calculates the difference between // The SquareOfSums and the SumOfSquares for the // first 'num' natural numbers func Difference(num int) int { return SquareOfSums(num) - SumOfSquares(num) }