Python Range Stack Overflow Error Recursive Function Meaning In Math