by Ricardo Fernández Serrata
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 and 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.
Rate and review within the app in the Community section.