Project Euler 6: (Iron)Python
- by Ben Griswold
In my attempt to learn (Iron)Python out in the open, here’s my solution for Project Euler Problem 6.
As always, any feedback is welcome.
# Euler 6
# http://projecteuler.net/index.php?section=problems&id=6
# Find the difference between the sum of the squares of
# the first one hundred natural numbers and the square
# of the sum.
import time
start = time.time()
square_of_sums = sum(range(1,101)) ** 2
sum_of_squares = reduce(lambda agg, i: agg+i**2, range(1,101))
print square_of_sums - sum_of_squares
print "Elapsed Time:", (time.time() - start) * 1000, "millisecs"
a=raw_input('Press return to continue')