#CJam, 9
How about this?
q~1$,=)*(
[Try it online][1]
Input is n i
where n
is the main input and i
is the index you want to get the value for.
Explanation:
q~ read and evaluate the input (n and i)
1$ copy n
,= basically this is a modulo (i%n) that avoids a negative result for negative i
)* increment, then multiply by n
( decrement
[1]: http://cjam.aditsu.net/#code=q~1%24%2C%3D)*(&input=3%200