I would suggest to implement iteratively (without recursion). We can use `while` loop and two variables `result` - current result and `n`.