Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following question:

Find the remainder of $29\times 2901\times 2017$ divided by $17$

I already have the answer (7) for this problem. I solved it using the long way by multiplying all of the numbers then divvy them with 17. I am just thinking if there are any fast way of solving this. My solution takes a long time.

share|cite|improve this question
    
What is "divvy"? If you haven't mastered grown-up language yet, then maybe you should skip the maths as well for now. – TMM 2 hours ago
up vote 9 down vote accepted

Hint:

If $$a\equiv b\pmod c$$ And $$d\equiv e\pmod c$$ You can multiply the two to get $$a\times d\equiv b\times e\pmod c$$

Doing this for the numbers separately, then multiplying the expressions will get you the solution very quickly.

share|cite|improve this answer
    
See here for this Congruence Product Rule. But here we can also exploit radix rep to mod out chunks of digits, which greatly simplifies the computation - see my answer. – Bill Dubuque 15 hours ago

You can write each number as a multiple of $17$ plus a small remainder:

$$(17+12)(170\cdot 17+11)(118\cdot 17+11).$$

When you multiply this out (which you don't have to do) every term is a multiple of $17$ except the last one $12\cdot 11\cdot 11$. So you need consider only this last product. We can repeat what we just did with a little factoring. The above $= 3\cdot 11 \cdot 4 \cdot 11 = 33\cdot 44 = (17+16)(2\cdot 17 + 10).$ So you need consider only $16\cdot 10$.

share|cite|improve this answer
2  
$(-5)\cdot(-6)\cdot(-6)$ is easier to compute. – tomasz 16 hours ago
1  
@tomasz Yes, but from the question, I don't think the OP knows about modular arithmetic yet, so dealing with a negative remainder is an extra complication. Although I see a "mod" answer was accepted as best, so maybe I'm wrong. – B. Goddard 16 hours ago

Find remainder after dividing $29 \times 2901 \times 2017$ by $17$.

Work $\mod 17$ !

\begin{align} & 29 \times 2901 \times 2017 \\ & 12 \times 1201 \times 317 \\ & 12 \times 1201 \times 147 \\ & 12 \times 351 \times 62 \\ & 12 \times 11 \times 11 \\ & 1452 \\ & 602 \\ & 92 \\ & 7. \end{align}

share|cite|improve this answer
    
This is much easier if one works with least magnitude reps (i.e. allow negative remainders), e.g. see my answer. – Bill Dubuque 15 hours ago

29 × 2901 × 2017 $\equiv$ 12 × 11 × 11 (mod 17)

12 × 121 $\equiv$ (mod 17)

12 × 2 $\equiv$ (mod 17)

24 $\equiv$ 7 (mod 17)

share|cite|improve this answer
    
Even faster if you use negative modulos to keep the numbers small, so in this case, the first line would be $(-5)*(-6)*(-6)$ – WorldSEnder 17 hours ago
    
Ok I keep in mind that. – Kanwaljit Singh 17 hours ago
1  
@KanwaljitSingh: $ (-a) \equiv (b - a) (\mathrm{mod}\, b)$ – Kevin 15 hours ago

This can be done in $15$ seconds of purely mental modular arithmetic of small numbers. To obtain optimal speedup we use least magnitude remainders, e.g. $-1$ vs. $16\pmod{\!17}$ since doing so simplifies subsequent arithmetic. To reduce a decimal number mod $n$ we continually mod out the leading chunks of its digits. Since we allow negative remainders, we will encounter negative digits, which we mark by a comma. We prove $\ 3247\equiv 0\pmod{\!17}\,$ for practice.

$\begin{align}{\rm mod}\ 17\!:\qquad &\,\ \color{#0a0}{32}\,47\\ \equiv\ &{\color{#0a0}{-2}},\color{#c00}47 \ \ \text{by }\ \ \ \ \ \,\color{#0a0}{32}\,\equiv\,\color{#0a0}{-2} \\ \equiv\ &\quad\ \ \color{#f84}{\bf 1}7\ \ \ \text{by }\ {\color{#0a0}{-2}},\color{#c00}4 \equiv\, \color{#0a0}{{-}2}(10)+\color{#c00}4\equiv -16\equiv \color{#f84}{\bf 1} \\[-.3em] \text{Let's do the number in the OP}\qquad\ \ \ \ \\[-.3em] &\,\ \color{#0a0}{29}\,01\\ \equiv\ & {\color{#0a0}{-5}},\color{#c00}01\,\ \text{ by }\quad\! \color{#0a0}{29\equiv -5} \\ \equiv\ &\quad\ \ \color{#f84}{\bf 1}1\ \ \text{ by }\ \color{#0a0}{{-}5},\color{#c00}0\equiv {\color{#0a0}{-5}(10)+\color{#c00}0}\equiv -50\equiv\color{#f84}{\bf 1}\\[-.2em] \text{Similarly $\,2017\equiv 11\equiv\,\color{#08f}{-6}\ $ hence}\phantom{MM}\\[-.2em] &\ 29\cdot 2901\cdot 2017\\ \equiv\ &(-5)(\color{#08f}{-6})(\color{#08f}{-6})\\ \equiv\ &(-5)\ \color{#08f} 2\\ \equiv\ &\ 7 \end{align}\qquad\qquad$

share|cite|improve this answer
    
$-501\equiv 9\pmod{17}$ (and not $11$). The long form of the first step would be $2901 \bmod 17 = (29*100+1) \bmod 17 = (29 \bmod 17)*100 +1$ and $29 \equiv -5 \pmod{17}$, but $-500 + 1 = -499$ and not $-501$. This only works because you do the same error on the next step and both errors cancel each other. – ipsec 13 hours ago
    
(+1) The OP did say "fast way" of finding the remainder, this is it! – Silverfish 11 hours ago
    
@ipsec It's not an error but, rather, use of negative digits. I've edited to make it more explicit. – Bill Dubuque 11 hours ago

The numbers are given in decimal representation, therefore I would start by simplifying $100 \bmod 17$. We have that $20\equiv 3$, therefore $100=20\times 5\equiv 3\times 5 = 15\equiv -2$. This allows us to write:

$$2900\equiv -2\times 29\equiv -2\times (-5) = 10$$

And

$$2000\equiv -2\times 20\equiv-2\times 3 = -6$$

We thus have:

$$29\times 2901\times 2017\equiv -5\times 11\times (-6) = 30\times 11\equiv -4\times 11\equiv -4\times (-6) = 24\equiv 7$$

share|cite|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.