2017-09-30 11:03:38 +08:00

14 lines
210 B
Python

def calc(limit):
a, b = 3, 5
n = 2
d = 1
for i in range(limit):
yield n
n += d * a
a, b = b, a + b
a, b = b, a + b
d = 3 - d
print(sum(list(calc(30))))