Iterative and recursive solutions to week 1