Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,3 +1,17 @@
def fib(n):
def nth_fib(n):
"""Nth Fibonacci term (by folding)
Nth integer in the Fibonacci series.
"""
from functools import reduce
return reduce(lambda x, y: (x[1], x[0] + x[1]), range(n), (0, 1))[0]
return reduce(
lambda acc, _: (acc[1], sum(acc)),
range(1, n),
(0, 1)
)[0]
# MAIN ---
if __name__ == '__main__':
n = 1000
print(f'{n}th term: {nth_fib(n)}')