What you ask for can be done using a for loop, but perhaps a while loop would be more appropriate. It depends on the specifics. Without tail recursion optimisation, recursion could be worse as there...