For Loop

That's because the author made the problem over-complicated. This is supposed to be an introductroy style problem and he went way over the mark. I was able to read the problem because I have a minor in math and have studied number and set theory in discrete mathematics.