Yes, see the "modulo" or "remainder" operator.
In reply to Re: sub as mathematical function by Corion in thread sub as mathematical function by Anonymous Monk