How can I simplify this simple code?

I think the modulo is easy enough.