this code prints out the digits to calculate requires four recursive calls plus the initial parent call on each recursiona copy of the methods variables is stored in memory once the method returns it is removed from memory the following is way we can visualize this processit may not necessarily be clear if recursion or iteration is better solution to particular problemafter all they both repeat series of operations and both are very well suited to divide and conquer approaches to algorithm design iteration churns away until the problem is done recursion breaks the problem down into smaller and smaller chunks and then combines the results iteration is often easier for programmersbecause control stays local to loopwhereas recursion can more closely represent mathematical concepts such as factorials recursive calls are stored in memorywhereas iterations are not this creates trade off between processor cycles and memory usageso choosing which one to use may depend on whether the task is processor or memory intensive the following table outlines the key differences between recursion and iterationrecursion iteration terminates when base case is reached terminates when defined condition is met each recursive call requires space in memory each iteration is not stored in memory an infinite recursion results in stack overflow error an infinite iteration will run while the hardware is powered some problems are naturally better suited to recursive solutions iterative solutions may not always be obvious