A modulo 13 problem

ayi

New member
Joined
Nov 9, 2014
Messages
1
Hi

I am having problem finding the remainder when 10^38 is divided by 13 i.e (10^38)mod13. Every time I calculate it myself I end up finding the answer 9 while matlab function 'rem(10^38,13)' always outputs 7.

For convenience I give my calculation here:(10^38)mod13=((13-3)^38)mod13=((-3)^38)mod13=((27)^12)*9 mod13=(1^12)*9 mod13=9

So, surely there something might have gone wrong.

Thanks in advance
-ayi
 
Hi

I am having problem finding the remainder when 10^38 is divided by 13 i.e (10^38)mod13. Every time I calculate it myself I end up finding the answer 9 while matlab function 'rem(10^38,13)' always outputs 7.

For convenience I give my calculation here:(10^38)mod13=((13-3)^38)mod13=((-3)^38)mod13=((27)^12)*9 mod13=(1^12)*9 mod13=9

So, surely there something might have gone wrong.

Thanks in advance
-ayi
Right idea so lets look at it
(a+b)n = \(\displaystyle \Sigma_{i=0}^{i=n}\) nCi \(\displaystyle a^{n-i} b^i = a \Sigma_{i=0}^{i=n-1}\) nCi \(\displaystyle a^{n-i-1} b^i\space \space +\space b^n\)
So with a = 13 and b = -3, we have (as you pointed out)
1038 = 13 m0 + (-3)38 = 13 m0 + 338

Let k = 3 i + j, j = 0, 1, 2
then,
3k = 27i 3j
= (2 * 13 + 1)i 3j
or, in the same manner as above,
3k = (2 * 13 m1 + 1i) 3j = 13 m2 + 3j

Now 38 = 3 * 12 + 2 so
338 = 13 m2 + 32 = 13 m2 + 9
and
1038 = 13 m0 + 13 m2 + 9 = 13 m3 + 9
and
1038 = 9 mod (13)

Seems to me to be correct

Edit to add: When you start playing with moderately large number, the accuracy of calculators, whether full blown super computers or hand helds, is limited to the way numbers are stored and used. That is, round off error occurs. In matlab see what rem(10^38+6,13) gives you. If the true answer were 7 for your problem and matlab computed exactly, you should get an answer of 0.
 
Last edited:
Hello, Ayl!

I agree with your answer.


Find \(\displaystyle 10^{38}\text{ (mod 13)}\)


\(\displaystyle 10^{38} \;=\; (10^2)^{19} \;=\;(100)^{19}\)

. . . .
\(\displaystyle \equiv\; (9)^{19} \text{ (mod 13)}\)

. . . .\(\displaystyle \equiv\;(9^3)^6\cdot 9\text{ (mod 13)}\)

. . . .\(\displaystyle \equiv\; (1)^6\cdot 9\text{ (mod 13)}\)

. . . .\(\displaystyle \equiv\; 9 \text{ (mod 13)}\)
 
Top