I\'m trying to implement the following function, but it keeps giving me the stack level too deep (SystemStackError) error.
Any ideas what the problem mi
I think this is the best answer, which was a response from another SO post asking a similar question.
The accepted answer from PriteshJ here uses naive fibonacci recursion, which is fine, but becomes extremely slow once you get past the 40th or so element. It's much faster if you cache / memoize the previous values and passing them along as you recursively iterate.