I am looking for a way to transform this recursive function to an iterative one. I have tried thinking about how to actually do it but it hurts me to think about it because