def pi(N): ns = itertools.takewhile(lambda x: x < N * 2, itertools.count(1, 2)) result = 0 c = -1 for n in ns: c = -c result += c * 4 / n return result
Sign in to make a reply
我思故我不存在