1

Let $p,N$ be positive integers with $N$ divides $p$. Does for every integer $X$, $[X\pmod{N}]\pmod{p}=X\pmod{p}$?

This question is similar to [1] - I consider it different due to $N$ now dividing $p$ instead.

I am trying to simplify the expression: $$\phi(n)=[(4n)*((4n)^{-1}\pmod{65537})]\pmod{65537*4*n}$$ where $\phi(n)$ is Euler's totient function, and I'm thinking of using the result above for simplifying the RHS.

[The particular example using 65537 I have derived using congruences on the RSA system and application of the CRT.]

Please state what the correct result is and why it's correct. [1][Modulo arithmetic (modulo of modulo)

1 Answers1

0

If $\,\gcd(4n,p) = 1\,$ then by CRT = Chinese Remainder Theorem (or Easy CRT) we have

$$\begin{align} &x\equiv 0\pmod{4n}\\ &x\equiv 1\pmod{p}\end{align}\,\iff\, x\equiv 4n((4n)^{-1}\bmod p) \pmod{\!4np}$$

Or, expressed in operator form, using the mod Distributive Law

$$ x\bmod 4np \,=\, 4n((4n)^{-1}\bmod p)$$

Generally there is no way to further simplify that other than computing the inverse.

The titled equation is not generally true, i.e. generally

$$ (x\bmod N)\bmod NK \,\neq\, x\bmod NK$$

For example when $\,x = N\,$ it becomes $\, 0 \neq N\bmod NK,\,$ true for all $K>1$ (and $N\neq 0)$

Bill Dubuque
  • 272,048
  • how about using $a^{p-2} \cong a^{-1} \pmod{p}$, so $(4n)^{p-2} \cong (4n)^{-1}$ - does this simplify the result? – unseen_rider Apr 29 '19 at 10:48
  • @unseen_rider That combined with repeated squaring is one way to compute modular inverses, but usually it is more efficient to use the Extended Euclidean Algorithm. – Bill Dubuque Apr 29 '19 at 19:28
  • Ok, so does this mean that the above $4n[(4n)^{−1}(modp)]$ simplifies to $4n[(4n)^{p-2}(modp)]=(4n)^{p-1}(modp)$ ? – unseen_rider Apr 30 '19 at 20:17
  • @unseen_rider No, $, x\equiv (4n)^{\large p-1}!\pmod{!4np},$ but that's not "simpler" - it has larger modulus $,4np > p.,$ The point of using $, 4n((4n)^{-1}\bmod p)$ is that we have reduced the modulus from $,4np,$ to $,p,,$ which simplifies the computation (e.g. consider $,p,$ very small compared to $n).,$ Ditto for $,4n((4n)^{\large p-2}!\bmod p),$ but, as I said, generally it is more efficient to compute the inverse via extended Euclidean vs. raising to power $,p-2.,$ – Bill Dubuque May 01 '19 at 01:48