I am trying to implement a simple algorithm in JavaScript. Wherever I look, it calls for the code to work out 1 (mod N). As far as I can tell, 1 modulo anything (or 1%N) is 1.

What am I missing? Is it always 1, and if so, why not just use 1?

Edit
Report