Polar_'s blog

By Polar_, history, 4 years ago, In English

Let's say I have an expression $$$x = k_1\cdot k_2 \cdot \cdot \cdot k_n \% MOD$$$.
Where $$$MOD$$$ is a prime number .
Now I want to divide $$$x$$$ with some $$$k_i\cdot k_j$$$ and I want to mutliply $$$x$$$ with some $$$p$$$ and $$$q$$$ .
Then is it true that $$$x = x{*}MODINV(k_i{*}k_j , MOD -2){*}p{*}q$$$ .

  • Vote: I like it
  • +16
  • Vote: I do not like it

»
4 years ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

Why Downvote him? He is simply asking for help.

Answer -> yes, you are right. but mod inverse should be with respect to mod and not mod — 2. And you forgot to take mod over whole value and at some intermediate steps Thanks.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    Thanks a lot ILoveBitches .
    Actually that MODINV meant to be power that was a mistake and I am taking the mod of whole where I am implementing it .
    Thanks again .