Reverse Modulus Operator

前端 未结 6 739
情深已故
情深已故 2020-12-13 13:54

Over 3 years after asking the question I found the solution. I have included it as an answer.

I have an expression with modulus in it that needs to

6条回答
  •  生来不讨喜
    2020-12-13 14:17

    yep. you're screwed.

    example:

    5 mod 3 = 2
    8 mod 3 = 2
    

    so inverse mod 2 is what? 8 or 5? or 11? or an infinitude of other numbers?

    Inverse mod is a relation, you start to get to more tricky mathematics if you try to pursue this. If you're in haskell you could easilyish model it with non-determinism (an infinite list of possible answers)

    Also, this isn't really a programming question. check out math exchange.

提交回复
热议问题