Definining the "$a \text{ mod } b$" operation to return b instead of 0.

41 Views Asked by At

How can I redefine the modulo operation over integers $a \text{ mod } b$ to return $b$ instead of $0$? Example: $7 \text{ mod } 3= 1$ but $6 \text{ mod } 3=3$.

1

There are 1 best solutions below

0
On

Render the function as $1+(a-1)\bmod b$. Done.