0

I know how to solve problems of the form "find the remainder of $a^{n} \bmod{b}$" when $a$ and $b$ are coprimes, and $n>\varphi(b)$, where $\varphi$ is Euler's totient function: by Euler's theorem, $$a^{\varphi(b)}\equiv 1 \pmod{b}$$ so all we need is divide with remainder $n$ by $\varphi(b)$: $$a^{n}\equiv a^{n \% \varphi(n)} \pmod{b}$$ and then $n\% \varphi(n)$ is less than $\varphi(n)$, which is typically not very high. However, I've encountered the following problem: using Euler's theorem, find $$19^{14} \pmod{70}$$ Now, $(19, 70)=1$, so Euler's theorem is applicable, and we have $19^{\varphi(70)}\equiv 1\pmod{70}$. However, $\varphi(70)=\varphi(7)\varphi(5)\varphi(2)=6 \cdot 4 = 24 > 14$, so it is not clear to me how Euler's theorem simplifies the calculation in this case. Of course, using the fast exponentiation algorithm, $19^{14} \pmod{70}$ can be calculated by hand pretty fast, but I don't see any use of the theorem here.

Bill Dubuque
  • 282,220
  • 1
    Since $70=2\times 5\times 7$ you can work it out for $2, 5, 7$ separately and then use the Chinese Remainder Theorem. That said, with numbers as small as this, iterated squaring is almost surely faster. – lulu Mar 29 '25 at 15:48
  • So you are saying this can only be done if CRT is already known? That's a pity – Daigaku no Baku Mar 29 '25 at 15:49
  • Obviously that isn't what I am saying. I explicitly proposed using Iterated Squaring instead, which makes no use of CRT. – lulu Mar 29 '25 at 15:50
  • @lulu I meant "if we want to use Euler's theorem, we have to use the CRT as well" – Daigaku no Baku Mar 29 '25 at 15:54
  • 1
    And this is a pretty weak use of CRT. CRT guarantees existence and uniqueness of a solution $\pmod {70}$ to the three separate congruences, but on its own it doesn't help you find that solution. And if you find it, by a search or whatever means, that tells you existence without needing to invoke the theorem. Uniqueness as well if your search is exhaustive. – lulu Mar 29 '25 at 15:54
  • If you liked, you could replace the $70$ with $71$, a prime, so that nothing like the trick I proposed is relevant. In that case, Iterated Squaring is clearly the way to go. – lulu Mar 29 '25 at 16:00
  • @lulu is it appropriate to VTC duplicate questions and not merely answer them? It appears my answer was downvoted after it flagged the commenters to vote to close. I want to know for future decisions. – theREALyumdub Mar 29 '25 at 16:19
  • 1
    @theREALyumdub If there is a good, clear duplicate target, you should vote to close and steer the OP to the other post(s). Of course, it gets fuzzy when the duplicate targets are more indirect...beginning students may not be so great at seeing the similarity and working out how to apply the one method to the other problem. So, in those cases it becomes a judgment call. In this case, I'd say the duplicate target was a solid fit. – lulu Mar 29 '25 at 16:24
  • @theREALyumdub, this is clearly NOT a duplicate, as explained in the edit (and as should be clear from the original question statement, frankly). – Daigaku no Baku Mar 29 '25 at 16:24
  • 1
    Hint: $,\color{#c00}6,\color{#0a0}{4}\mid 12\Rightarrow 19^{12} \equiv 1\pmod{!70},$ since it's true $!\bmod \color{#c00}7,\color{#0a0}5,2.,$ See the linked dupes, esp. parts on CRT and Carmichael Lambda, e.g. here. $\ \ $ – Bill Dubuque Mar 29 '25 at 16:25
  • I rolled back your edit because the claim is false - see the prior comment. Please be patient while dupes are being processed, and please search for answers before asking questions. – Bill Dubuque Mar 29 '25 at 16:26
  • @BillDubuque, I've read both your answer in one of the linked "dupes" and the accepted answer of the other guy in the other. I also tried to follow all of the links in your answer, and reading some of their contents. Still, I state that
    1. The answer to my problem is not present there in explicit form. Note that I ask specifically about avoiding both using the CRT and the fast exponentiation, but only using Euler's theorem, if possible. Using Carmichael function in this context is strange.
    2. Even if the answer is present there implicitly, I wasn't able to understand it
    – Daigaku no Baku Mar 29 '25 at 21:54
  • Your question says nothing about avoiding CRT. The prior comment explains how to do it using either CRT, Carmichael's Lambda generalization of Euler's Totient Theorem (or various closely related methods). There are no other methods that work generally - only those explained in the linked dupes. They already apply to the example you gave (cf. my prior comment) so it is not clear why you are not satisfied. – Bill Dubuque Mar 29 '25 at 22:07
  • @DaigakunoBaku Your point 2) is the point of contention - we can't force you to understand, only give you the tools to help! And yes, the answer is in those links. – theREALyumdub Mar 29 '25 at 22:27
  • Re: "can't understand it". For your example, see here and here (they are special cases of the CRT / Carmichael methods I mentioned above). If anything remains unclear please precisely pinpoint where the difficult lies. – Bill Dubuque Mar 29 '25 at 22:39
  • @BillDubuque do I understand it correctly that in general, the least power $k$ such that $a^{k} \equiv 1 \bmod{a}$ is $\text{lcm}{{\varphi(p^{n_{i}}{i})}{i=1}^{m}}$ where $p_{i}$ are prime factors of $a$ and $\prod_{i} p_{i}^{n_{i}}=a$? – Daigaku no Baku Apr 01 '25 at 10:03
  • @DaigakunoBaku, what is your question? Do you understand the CRT's application (you have stated the CRT) to the computation of number theoretical mulitplicative groups? Are you asking about computational speed when the CRT has $ n < \phi(b)? $ If indeed that inequality holds, then Euler's Theorem on modulus b does not apply. – theREALyumdub Apr 03 '25 at 18:05

0 Answers0