Euler project 28

#-*- coding:utf-8 -*-
from datetime import datetime

def sequence(x,n):
	low = x[-1]
	for i in xrange(1,5):
		x.append(low + i*n)
	return x

def Euler28():
	total = [1,3,5,7,9,13,17,21,25]
	n = 6
	while n < 1001:
		total = sequence(total, n)
		n += 2
	return sum(total)
	
def main():
	start = datetime.now()
	answer = Euler28()
	end = datetime.now()
	print end - start, answer

if __name__ == "__main__":
        main()


#実行結果
0:00:00.001388 669171001