1

Here's an example of what I mean for mod 3: $1 => 1$, $2 => 2$, $3 => 3$, $4 => 1$ and so forth. This is for computer programming and while obviously I can easily calculate this I am simply curious whether it's possible without comparisons.

chx
  • 1,807

1 Answers1

1

$$1 + ((n - 1) \mod 3)$$

I need more characters so here they are.

Yiyuan Lee
  • 14,435