euler/006.py
Correl Roush 44604b08c7 Problem 006
git-svn-id: file:///srv/svn/euler@25 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
2010-04-12 15:53:05 +00:00

9 lines
274 B
Python

def squarediff(n):
sumofsquares = sum([x**2 for x in range(n + 1)])
print 'Sum of squares', sumofsquares
squareofsum = sum(range(n + 1))**2
print 'Square of sum', squareofsum
print 'Difference', squareofsum - sumofsquares
squarediff(10)
squarediff(100)