As of version 3.8, it is well-known that python treats [tail recursion](https://en.wikipedia.org/wiki/Tail_call) poorly and it by default has a low recursion depth. Although `sys.setrecursionlimit(limit)` seems to bypass this problem, at some larger inputs a segmentation fault is raised indefinitely.
There is no workaround. Therefore, the program will be written in later versions as an iterative form, rather than recursive.
Aside: related PEP's
* [PEP 651](https://www.python.org/dev/peps/pep-0651/): Robust Stack Overflow Handling (created 18-Jan-2021)