1

The theorem says that:

$a^{\phi(n)}\equiv1\mod n$ only holds if $gcd(a, n)=1$

However, I found it somewhere (in the solution of problem E in 2016 nordic programming contest), that the following also holds for all $a$ and $n$ (not restricted to the previous condition):

${a^{\phi(n)\ +\ e\ mod\ \phi(n)}}\equiv{a^e} \mod n$ if $e \geq log_2(n)$

is that true? is it a corollary of Euler-Fermat theorem? can I find a proof of it anywhere?

Narek Bojikian
  • 387
  • 2
  • 13

1 Answers1

1

This result is true.

We will first prove $a^e \equiv a^{e + \phi(n)} \pmod{n}$ for all $e \ge log_2(n)$. This is done by induction, assume this is true for all values less than $n$ and now prove it for $n$.

If $\gcd(a, n) = 1$, then this of course is true. Now, assume that $a$ and $n$ have some common divisors. Denote by $v_p(x)$ the largest exponent of $p$ dividing $x$ (As usual). Let $p$ be a prime such that $p \mid \gcd(a, n)$, and let $v_p(\gcd(a, n)) = m$.

Lemma 1 $v_p(a^e) \ge v_p(n)$

Proof $v_p(a^e) \ge e \ge \log_2(n) \ge v_p(n)$ where the last inequality holds since $v_p(n) \le log_p(n)$ for all $n, p$.

Let $a = p^m \cdot b$, where $p \nmid b$, and $n = p^k \cdot t$, $p \nmid t$. Now, the equation

$a^{\phi(n) + e} \equiv a^e \pmod{n}$

is equivalent to

$p^{m(\phi(n) + e)}b^{\phi(n) + e} \equiv p^{me}b^e \pmod{p^kt}$

Due to the lemma we have $me \ge p^k$, so we can divide both sides by $p^k$, also reducing the modulo to $t$ only. Then, as we have $\gcd(t, p) = 1$, we can divide both sides of the resulting equation by $p^{me - k}$. We are left with

$p^{\phi(n)}b^{\phi(n) + e} \equiv b^e \pmod{t}$

Since phi-function is multiplicative, $\phi(n)$ is divisible by $\phi(t)$. Thus, by Euler we have $p^{\phi(n)} \equiv 1 \pmod{t}$. Therefore, we only need to prove

$b^{\phi(n) + e} \equiv b^e \pmod{t}$, or, by similar logic than above, $b^{\phi(t) + e} \equiv b^e \pmod{t}$.

This is similar to the equation we started with. We are done due to the induction assumption.

For the initial question: we can use the same logic as above except for one thing: we don't know if $v_p(a^{\phi(n) + e \pmod{\phi(n)}})$ is greater than or equal to $v_p(n)$. This, however, is fixable:

Claim $\phi(n) \ge v_p(n)$ for all $p \mid n$ and $n \ge 1$.

We prove this in a non-elegant way. First, we note that almost all cases can be solved just by $v_p(n) \le log_2(n)$. We check the rest of the cases manually.

Lemma 2 $\phi(n) \ge log_2(n)$ for all $n \ge 16$

Proof In Is the Euler phi function bounded below? we have $\phi(n) \ge 480 \cdot \Big( \frac{n}{2310} \Big)^{25/26}$. This is at least $\log_2(n)$ for $n \ge 16$: https://www.wolframalpha.com/input/?i=solve+480+*+(n%2F2310)%5E(25%2F26)+%5Cge+log_2(n)

Also note that this is $\ge \log_3(n)$ for $n \ge 7$. (Again, use Wolfram Alpha)

So, now we have this inequality proved for all $n \ge 16$. Also, since we don't care about $v_p(n)$ for $p \nmid n$, we are left to check the cases where $n$ is even and $n < 16$, or $n$ is arbitrary and $\le 6$. First, we check the claim $n \le 6$. $\phi(n)$ is equal to $1, 1, 2, 2, 4, 2$ for $n = 1, 2, 3, 4, 5, 6$. Now it is easy to see that $v_p(n)$ is at most $\phi(n)$ for all these values.

For cases $n > 6$ and $n$ is even: since $\phi(n) \ge 2$ for all $n \ge 2$, we must have $n$ divisible by some square, or else the claim holds. This square can't be the square of some prime $\ge 3$, as otherwise we would have $n \ge 2 \cdot 3^2 = 18 \ge 16$, and these cases were solved. Thus, $n$ must be divisible by $4$. We have to check cases $n = 8$ and $n = 12$. For these values $\phi(n) \ge v_p(n)$ holds.

Thus, the answer to the question you asked is positive.

Loppukilpailija
  • 313
  • 1
  • 6