title: How can I modulo when my numbers start from 1, not zero?
body: <p>I guess the solution for this is quite simple, but I've been thinking about it for a while and couldn't come up with an elegant solution.</p>
  
  <p>I have a range of numbers, e.g. <code>1..10 = (1,2,3,4,5,6,7,8,9,10)</code>, which is circular, meaning the number after the last one is again the first one (<code>next(10)=1</code>).</p>
  
  <p>For a given number <code>i&gt;0</code> in the range, I would like to calculate the next <code>m</code>-th, and previous <code>m</code>-th number. e.g. <code>next(5,1)=6</code> <code>next(10,1)=1</code> <code>next(10,2)=2</code> <code>prev(5,2)=3</code> <code>prev(1,1)=10</code> <code>prev(1,2)=9</code>.</p>
  
  <p>For <code>next</code> I can just take <code>(i+m)%n</code> where <code>n</code> is the length of the range (<code>n=10</code> in the example). But for <code>prev</code> I couldn't find an elegant solution.</p>