const fibonacci = (n, p = 0, c = 1, s = 0) => (s >= n ? p : fibonacci(n, c, p + c, s + 1));
def fibonacci(n, p=0, c=1, s=0, cache={"largestStep": 0}):
if cache.get(n):
return cache[n]
if cache["largestStep"] > s:
_s = cache["largestStep"]
_p = cache[_s]
_c = cache[_s - 1] + _p
return fibonacci(n, _c, _p + _c, _s + 1)
cache["largestStep"] = s
cache[s] = p
return fibonacci(n, c, p + c, s + 1)