I built a decorator with the memoize idea: it will take care of your system recursion limit, and avoid it by splitting calculation in batches that are as large as the system can offer. It will also of course remember all the values for easy retrieval
Short working version:
import sys
from math import floor, ceil
def memoize(f):
memo = [None]