Today, a short post with a Python recursive function that finds the nth Fibonacci number.
File: pyscimark_fibonacci.py
----------------------------
cache = {1:1, 2:1}
def fib(n, cache):
if n not in cache:
cache[n] = fib(n-1, cache) + fib(n-2, cache)
return cache[n]
assert([fib(i, cache) for i in range(1,10)] == [1,1,2,3,5,8,13,21,34])
Want more fast scripts? Check out these scripts to find a list of prime numbers and the divisors of a number.

Marina Mele has experience in artificial intelligence implementation and has led tech teams for over a decade. On her personal blog (marinamele.com), she writes about personal growth, family values, AI, and other topics she’s passionate about. Marina also publishes a weekly AI newsletter featuring the latest advancements and innovations in the field (marinamele.substack.com)