This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tdignan
Recipients tdignan
Date 2011-11-24.03:49:54
SpamBayes Score 9.022011e-11
Marked as misclassified No
Message-id <1322106595.12.0.230558460851.issue13468@psf.upfronthosting.co.za>
In-reply-to
Content
On my system, the magic number to make this segfault seems to be 26200:

tom@tralfamadore ~/Downloads $ python recur1.py  26199
160164968

tom@tralfamadore ~/Downloads $ python recur1.py  26200
Segmentation fault

Here's the source:

#!/usr/bin/python
import sys

if len(sys.argv) < 2:
    print "usage %r <number>" % sys.argv[0]
    sys.exit(1)

number = int(sys.argv[1])

sys.setrecursionlimit(number + 2)

f = (lambda n: (f(n - 1) if n > 0 else 0) + 
    (n if n % 3 == 0 or n % 5 == 0 else 0))

print f(number)

sys.exit(0)
History
Date User Action Args
2011-11-24 03:49:55tdignansetrecipients: + tdignan
2011-11-24 03:49:55tdignansetmessageid: <1322106595.12.0.230558460851.issue13468@psf.upfronthosting.co.za>
2011-11-24 03:49:54tdignanlinkissue13468 messages
2011-11-24 03:49:54tdignancreate