git @ Cat's Eye Technologies Bhuna / rel_0_7_2014_0819
Silly thing. It's in the Dipple if I ever need it. Chris Pressey 7 years ago
1 changed file(s) with 0 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
+0
-20
eg/ack.py less more
0 #!/usr/bin/env python
1 # $Id: ackermann.python.html,v 1.5 2004/07/03 07:11:34 bfulgham Exp $
2 # http://www.bagley.org/~doug/shootout/
3 # from Brad Knotwell
4
5 import sys
6
7 def Ack(M, N):
8 if (not M):
9 return( N + 1 )
10 if (not N):
11 return( Ack(M-1, 1) )
12 return( Ack(M-1, Ack(M, N-1)) )
13
14 def main():
15 NUM = int(sys.argv[1])
16 sys.setrecursionlimit(3000)
17 print "Ack(3,%d): %d" % (NUM, Ack(3, NUM))
18
19 main()