mirror of
https://github.com/correl/euler.git
synced 2024-11-30 11:09:52 +00:00
Problem 006
git-svn-id: file:///srv/svn/euler@25 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
daa7b36149
commit
44604b08c7
1 changed files with 9 additions and 0 deletions
9
006.py
Normal file
9
006.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
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)
|
Loading…
Reference in a new issue