diff options
author | Braxton Hall | 2022-10-24 00:05:36 +0000 |
---|---|---|
committer | GitHub | 2022-10-24 00:05:36 +0000 |
commit | 35c784629a2cc85ce4581d1cff401a2525d377cd (patch) | |
tree | 01e736d040d688964623d35ff1eae81d6a544b4a /entries | |
parent | c4b8d5fcd71f4f8a006234dabc5a1958e32cd63e (diff) | |
parent | d0513187789505955e41441973c63848ec247cbc (diff) |
Merge pull request #10 from Tarcisio-Teixeira/Tarcisio-Teixeira-patch-1
Update fib.py
Diffstat (limited to 'entries')
-rw-r--r-- | entries/Tarcisio-Teixeira/fib.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/entries/Tarcisio-Teixeira/fib.py b/entries/Tarcisio-Teixeira/fib.py index 1246517..a73cdd2 100644 --- a/entries/Tarcisio-Teixeira/fib.py +++ b/entries/Tarcisio-Teixeira/fib.py @@ -2,4 +2,4 @@ def fib(n,arr={},v =-1): if v>=0: arr[n]=v return v - return arr[n] if n in arr.keys() else fib(n, arr, (3*n*n*n - 9*n*n+13*n)//6 if n <= 3 else fib(n//2-1,arr)*fib(n-n//2,arr) + fib(n//2,arr)*fib(n-n//2+1,arr)) + return arr[n] if n in arr.keys() else fib(n, arr, (2*n*n*n - 9*n*n+13*n)//6 if n <= 3 else fib(n//2-1,arr)*fib(n-n//2,arr) + fib(n//2,arr)*fib(n-n//2+1,arr)) |