Suppose you have this in python
# aka riemann serie
def p_serie(p):
assert(p>0)
s = 0
n = 1
while True:
s += 1.0/pow(n,p)
yield s
n += 1
then run
itr = p_serie(2)
[next(itr) for _ in range(10)]
that output (reformatted)
[ 1.0,
1.25,
1.3611111111111112,
1.4236111111111112,
1.4636111111111112,
1.4913888888888889,
1.511797052154195,
1.527422052154195,
1.5397677311665408,
1.5497677311665408
]
(1/2)