0

I'm trying to find an easy and fast way to get the result of $$353094232\bmod721$$ I would solve this by dividing manually the terms until I get the remainder of dividing, but I was wondering if there is a faster way, like breaking down $721$ in $7\cdot103$ and doing something.

I can't find any theorem or property regarding this specific case.

Parcly Taxel
  • 103,344
  • 4
    Long division is pretty easy. If you want to use the Chinese Remainder Theorem, that works too...but I doubt it saves time. – lulu Aug 01 '19 at 15:32
  • 1
    $353094232 \bmod 721=344$. – Dietrich Burde Aug 01 '19 at 15:33
  • @DietrichBurde I don't think this is a duplicate of the other since we are not aware of the factorization of $353094232$ without first looking for it and there is no guarantee that it is a perfect power. The question would seem to be about finding a general method regardless of if it is a perfect power or not. – JMoravitz Aug 01 '19 at 15:35
  • @JMoravitz Sorry, this was the wrong link. – Dietrich Burde Aug 01 '19 at 15:36
  • For fast modular computation see here. – Dietrich Burde Aug 01 '19 at 15:36
  • 1
    Long division is seriously the best way to go. – Randall Aug 01 '19 at 15:40
  • long division is the way to go. Fortunately we don't have to keep track of the quotient-- we can just toss out the divisors. If you are doing this on paper or in your head tossing out $7$s and $103$ will be easier than $721$ but it make take a bit of calculation to convert $a\mod 7$ and $b\mod 103$ to $c\mod 721. – fleablood Aug 01 '19 at 15:55
  • Thank you for all your comments and answers! I will solve with the long division method, then – Dave Venturini Aug 01 '19 at 15:59
  • Casting out $7$ give you $1\mod 7$ fairly easily. Casting out $103$ gives you $35 \pmod 103$ with a little bit more but not much trouble. $103K+35=7M + 1$ can be solved by rewriting $98K + 35 + 5K = 7M + 15$ is solvable with $K=3$ and $M=14K+5$. – fleablood Aug 01 '19 at 16:24
  • I added a CRT solution by casting out $103$ (probably similar to what @fleablood had in mind in the prior comment). – Bill Dubuque Aug 01 '19 at 16:58
  • @BillDubuque Actually not what I had in mind. I literally threw out multipls of $103$ which wasn't hard but certainly wasn't worth writing about. $100 \equiv -3\pmod 103$ would have been a lot easier. – fleablood Aug 01 '19 at 17:07
  • We can speed up the calculation if we have a power modulo some number. But for a number modulo a number there is no possibility for a speed-up. We just have to compute it with a division with remainder. – Peter Sep 24 '22 at 09:21
  • If we want to do it by hand, in the case of a number with small prime factors , as $60$ , it might be an advantage to use the chinese remainder theorem. But in this case, we are reduced to $103$ which has no big effect. – Peter Sep 24 '22 at 09:26

1 Answers1

2

It's doable in a minute of mental arithmetic via CRT. $\bmod 103\!:\ 100\equiv -3\Rightarrow p(100)\equiv p(-3)\,$ for any polynomial $\,p(x)\,$ with integer coefs, by here or by the Polynomial Congruence Rule. In particular when we write an integer $\,n\,$ in radix $100$ this this yields $n = p(100)$ as a (radix) polynomial $\, n = p(100) = d_0 + d_1(100) + d_2(100^2)+\cdots,\,$ whose coef's $d_i$ are its radix $100$ digits. A handy way to evaluate $\,n = p(100)\equiv p(-3)\,$ is to write the polynomial in "nested" Horner form and evaluate it "inside out" as below - with $\rm\color{#90f}{partial}\ \color{#0a0}{eval}\color{#c00}{uations}$ written below it.

$\!\!\begin{align} \bmod 103\!:\,\ n = \color{#f6f}3,\color{#0af}{53},09,\color{#0a0}{42},32_{\:\!100} = (((\color{#f6f}3(100)+&\color{#0af}{53)}\,100\,+\,9)\,100\,+\,\color{#0a0}{42})\,100\,+\,32 = p(100)\\[.3em] \text{thus, by $\,100\equiv -3,\ $}\,\ n\equiv (((\color{#f6f}3\,({-3}) + &\color{#0af}{53})({-3}) + 9)\color{#90f}{(-3)}+\color{#0a0}{42})(-3) + 32\equiv 35\\ \text{evaluating from inside-out yields:}\ \ \ \ \ \ &44)\ \ \ \ \ \ \ \ \underbrace{\color{#90f}{{-}20)}\ \ \ \ \ \ \ \ \ \ \ \ {\color{#c00}{-1}}}_{\large\!\!\!\! \color{#90f}{-20(-3)}\ +\ \color{#0a0}{42}\ \equiv\ \rlap{\color{#c00}{-1}\ }})\ \ \ \ \ \ \ \ \ \ \ \ \ 35)\\ \end{align}$

$\!\bmod 7\!:\ \ \ \ \ \ 353094232\equiv 1\,$ by this Remark ($10$ secs of mental arithmetic).

$\!\bmod 721\!:\,\ 353094232\equiv 35+103\underbrace{\left[\dfrac{1\!-\!35}{103}\bmod 7\right]}_{\Large\frac{-34}{-2}\equiv\ 17\ \equiv\ 3}\equiv 344\ $ by Easy CRT

Though it is instructive, it is not any quicker than long division. But it may be for other numbers.

Bill Dubuque
  • 272,048
  • See here for another example of modular Horner poly evaluation notated more concisely, which shows how to simplify calculation using negative digits. – Bill Dubuque Sep 24 '22 at 08:01