Skip to content

Python implementation and visualization of the Ackermann function

Notifications You must be signed in to change notification settings

nschmeller/ackermann

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

See how the Ackermann function works!

I implemented the two argument Ackermann function in Python and added a print for each recursive call so you can see what's going on. Just clone this repo (or even copy the script into your own file), navigate to the script, and run python3 ackermann.py m n, where m and n are the two nonnegative arguments to the Ackermann function. For python3 ackermann.py 1 2, you should see

% python3 ackermann.py 1 2
(1, 2)
 (1, 1)
  (1, 0)
   (0, 1)
  (0, 2)
 (0, 3)

ack(1, 2) = 4

Warning: the Ackermann function is famous because it gives computers a headache. Expect a RecursionError when running ackermann.py with m > 3. n can go approx two orders of magnitude higher.

Enjoy!

About

Python implementation and visualization of the Ackermann function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages