So last night, tired of writing a new Python function whenever I wanted to write a new recurrence test question, I wrote a recurrence harness. It turns a handful of basic lines of code into two, but more importantly, because I can re-use the harness it is worth spending the time to write proper error checking and to memoize it. Here is the code . Below here are some examples. Note that, because this is memoized, we get the 4000th Fibonacci number essentially instantly, while without memoization, the runtime increases faster than the Fibonacci sequence itself, so, even if we could do one recursive call per nanosecond, we would be looking at roughly 1.2 * 10 819 years for the recursive version to finish... and that's a long time for students to wait for their final to be graded. The 4000th Fibonacci number: fibb = {0: 0, 1: 1} def fibf(n, bases): return recur(n - 1, bases, fibf) + recur(n - 2, bases, fibf) In [3]: recur(4000, fibb, fibf, True) Out[3]: 39