What Larry was asking about was this Modular arithmetic - Wikipedia
It is a way of turning numbers that go on getting bigger into a sequence of numbers from zero to some value that keep cycling. It is a very useful concept if you want to write the sort of code you are trying to write.