[Tutor] strange recursion result

Nate Bargmann Nate Bargmann <n0nb@networksplus.net>
Sun, 7 Jan 2001 16:26:41 -0600

On Sun, Jan 07, 2001 at 04:01:30PM -0600, mbc2@netdoor.com wrote:
> It works fine if I feed it numbers between 1 and 999. Anything larger than
> 999 doesn't work. I get an error in the "return
> (n-1)+rlgncount(n-1)" line.

I'm no expert in recursion.  However, I ran your script both in Idle and
as an executable script.  It worked fine each time, using the values of
1000, 100, and 1001.  When I set n to 10000 I received the following error:

  File "./recurse.py", line 7, in rlgncount
    return (n-1)+rlgncount(n-1)
RuntimeError: Maximum recursion depth exceeded

The first two lines were repeated quite a number of times, so I'm not
sure of the limit to  recursion depth.  Whether or not that is something
that may be changed, I don't know, but it's the only error I found.  I'm
running Debian 2.2r2 with Python 1.5.2.

- Nate >>

 Wireless | Amateur Radio Station N0NB          | "None can love freedom
 Internet | n0nb@networksplus.net               | heartily, but good
 Location | Wichita, Kansas USA EM17hs          | men; the rest love not
   Wichita area exams; ham radio; Linux info @  | freedom, but license."
             http://www.qsl.net/n0nb/           | -- John Milton