------
## 最终结论
```python
def sum_difference(n):
    # 计算前 n 个自然数的和
    sum_n = n * (n + 1) // 2
    # 计算前 n 个自然数的平方和
    square_sum_n = sum(i * i for i in range(1, n + 1))
    # 返回平方和减去和的平方的差值
    return sum_n ** 2 - square_sum_n

# Test cases
assert sum_difference(12) == 5434
assert sum_difference(20) == 41230
assert sum_difference(54) == 2151270
```