fixed recursive algorithm edge cases (15, 16, 20, 21)
completed iterative solution without loops or if branches