a function that takes 1,2,3 and returns 3,1,2 respectively and vice verse

Posted by Thunder on Stack Overflow See other posts from Stack Overflow or by Thunder
Published on 2010-03-12T07:14:15Z Indexed on 2010/03/12 8:07 UTC
Read the original article Hit count: 171

Filed under:
|

Is there a function that takes 1,2,3 and returns 3,1,2 respectively and vice-verse. eg: f(1)=3 f(2)=1 f(3)=2

This is required to get the cyclic order eg 1 when gone left will be 3 , 2 will be 1 and 3 will be 2. 1 when gone right will be 2 , 2 will be 3 and 3 will be 1.

© Stack Overflow or respective owner

Related posts about function

Related posts about numbers