From 44604b08c72d317b0eb6bc4684e0b2f284d5feb6 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 12 Apr 2010 15:53:05 +0000 Subject: [PATCH] Problem 006 git-svn-id: file:///srv/svn/euler@25 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- 006.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 006.py diff --git a/006.py b/006.py new file mode 100644 index 0000000..91c8006 --- /dev/null +++ b/006.py @@ -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)