I'm searching for an elegant way to increment and decrement around a 'circle' of numbers like a clock.
Assuming the numbers 1,2,3 are my set of numbers on the clockface I want to perform the following mathematical operations:
1 + 1 = 2
1 + 2 = 3
1 + 3 = 1
1 - 1 = 3
I'm sure there must be a name for this kind of math, and lots of tricks for performing these calculations using the 'normal' rules of arithmetic. Looking for pointers as to what field of math studies these problems, or a set of simple/fast algorithms for doing the 'wrapping'.