by Ricardo “Rudxain” Fernández Serrata
Version 5 (September 26, 2023)
Download (94 downloads)
This function can easily cause overflows of many kinds in many programming languages, so be careful.
As you can see, there is an obvious speed-memory killer, which is the tail-call (the subroutine at the bottom of the flow). That call is there because this is the verbatim definition.
The variables `out` and `n` can be merged into 1 var without affecting the computation. They aren't merged here because I wanted to preserve a copy of the original input argument (n) to print it when halting.
ℹ en.wikipedia.org/wiki/Ackermann_function
Optimized: llamalab.com/automate/community/flows/39647
Rudxain profile: llamalab.com/automate/community/flows/42921
Tags: big math slow recursive recursion
LICENSE: https://unlicense.org
5 stars | 0 | |
4 stars | 0 | |
3 stars | 1 | |
2 stars | 0 | |
1 star | 0 | |
Reports | 0 |
Rate and review within the app in the Community section.