There is a lesser known generalization of Euler's Theorem. Here 'x' and 'm' are NOT COPRIME and $\,n\ge \log_2 m.\,$ I stumbled upon this on this site : http://cp-algorithms.com/algebra/phi-function.html The "derivation" can be found towards the end of the above link; but i can't seem to wrap my head around it. It would be really great if it could be explained a bit better, probably with an example.

- 272,048

- 51
-
Do you already know how to prove Euler's theorem? – Franklin Pezzuti Dyer Oct 01 '18 at 17:20
-
Yes, I kind of understood it. But i didn't understand it from wikipedia. I went through some other resource which was able to generalize from Fermat's little theorem. – Aizen Oct 01 '18 at 17:32
-
Problem is here, 'x' and 'm' aren't coprime.. x and m can be any number. and 'n' >= log2(m) – Aizen Oct 01 '18 at 17:37
-
Could you please go through the link I have added. What you are talking about is different from what I am looking for. – Aizen Oct 01 '18 at 17:40
-
It would be easier to explain what you don't understand about the proof. It's pretty clear to me – Jakobian Oct 01 '18 at 18:36
-
In the derivation, an intermediate result : $x^n \bmod m = x^k\left(x^{n-k \bmod \phi(\frac{m}{a})} \bmod \frac{m}{a}\right)\bmod m$ is reached. Till that i understood, after that when the discussion about 'cycle' length started, i couldn't understand. – Aizen Oct 01 '18 at 19:18
2 Answers
It is a special case of following generalization of the Euler-Fermat theorem. Indeed, let $\phi = \phi(m).\,$ By division we can write $\, n = q\,\phi + r,\,$ for $\,r = n\bmod \phi.\,$ Then the claim is that $$\bmod m\!:\,\ a^{\large q\,\phi+r}\equiv a^{\phi + r}\ \ \ {\rm i.e.}\ \ \ a^{\phi+r}(a^{(q-1)\phi}-1)\equiv 0,\ \ {\rm for\ all}\,\ a\in\Bbb Z\qquad$$
By the Theorem below this is true if $\,e := \phi + r\,$ is as least as large as the largest exponent in the prime factorization of $m$. The point is that we need to choose $\,e\,$ large enough so that the factor $\,a^e\,$ is divisible by all $\, p^{\large e_i}\,$ when $\,p\mid a,\,$ since then its cofactor $\,a^f-1\,$ is not divisible by $p.$
Theorem $\ $ Suppose that $\ m\in \mathbb N\ $ has the prime factorization $\:m = p_1^{e_{\:1}}\cdots\:p_k^{e_k}\ $ and suppose that for all $\,i,\,$ $\ e\ge e_i\ $ and $\ \phi(p_i^{e_{\:i}})\mid f.\ $ Then $\ m\mid a^e\,(a^f-1)\ $ for all $\: a\in \mathbb Z.$
Proof $\ $ Notice that if $\ p_i\mid a\ $ then $\:p_i^{e_{\:i}}\ |\ a^e\ $ by $\ e_i \le e.\: $ Else $\:a\:$ is coprime to $\: p_i\:$ so by Euler's phi theorem, $\!\bmod q = p_i^{e_{\:i}}\!:\, \ a^{\phi(q)}\equiv 1 \Rightarrow\ a^f\equiv 1\, $ by $\: \phi(q)\mid f.\ $ Since all $\ p_i^{e_{\:i}}\ |\ a^e\ (a^f - 1)\ $ so too does their lcm = product = $m$.
Remark $\ $ You can find many illuminating examples in prior questions, e.g. below

- 272,048
-
Got it! Thanks a lot for the response. Can you suggest some good resources to learn Group Theory. I feel like Group theory is a powerful tool to have. I see it pretty much in all number theory proofs. (Your proof didn't need any of it. My request is in general) – Aizen Oct 02 '18 at 18:16
-
1@Aizen Glad it helped. It's difficult if not impossible to make such recommendations without knowing much more about your background. To start I'd suggest browsing abstract algebra textbooks to find one at your level (and search the web to find recommendations for reputable textbooks since some are very poorly written). – Bill Dubuque Oct 02 '18 at 18:26
-
1@Aizen Can I just say, if you look online you may find the reccomandation for Dummit and Foote. In my opinion as a student, that is the worst math book I have ever seen. Just general, for abstract algebra books, I would reccomend Herstein (he has two books, one for undergrads and one for grads), Joseph Gallian, Fraleigh. – Ovi Oct 02 '18 at 20:03
-
@Ovi Thanks a lot for your valuable feedback. Yes, I did encounter a bunch of recommendations for Dummit and Foote, as well as Herstein. I will look into both and see which one appeals me more. Thanks again. :) – Aizen Oct 03 '18 at 05:48
Let $m=ab$ with $\gcd(a,b)=\gcd(x,b)=1$. Then $$x^{\varphi (b)} \equiv 1\pmod b$$ If $a\mid x^k $, then $$x^k x^{\varphi (b)} \equiv x^k\pmod {m}$$ This means that for $n\geq k$ the sequence $n\to x^n\bmod m$ is periodic with period $\varphi(b)$.
Since $\varphi (m)=\varphi(a)\varphi(b) $, we have, in particular, $$x^k x^{\varphi (m)} \equiv x^k\pmod {m}$$ hence for $n\geq k$ the sequence $n\to x^n\bmod m$ is also periodic with period $\varphi(m)$.
Since $a\mid x^{\varphi (m)} $, we can choose $k=\varphi(m)$, thus obtaining: $$x^{2\varphi (m)} \equiv x^{\varphi (m)}\pmod {m}$$ which says that for $n\geq\varphi(m)$ the sequence $n\to x^n\bmod m$ is periodic with period $\varphi(m)$.
Consequently, for $n=q\varphi(m)+r$ with $r=n\bmod\varphi(m)$ and $q\geq 1$ we have \begin{align} x^n &=x^{q\varphi(m)}x^r\\ &\equiv x^{\varphi(m)}x^r\pmod m\\ &\equiv x^{\varphi(m)+r} \end{align} because $x^{q\varphi(m)}\equiv x^{\varphi(m)}\pmod m$, which proves the assertion.

- 16,054
-
I simply am dumb enough to get the "periodic" part. I got lost in that line itself. Can you please elaborate on that, probably with some example. – Aizen Oct 02 '18 at 18:20