8/13/2019 10 - Modular Arithmetic
1/116
Art of Problem Solving
WOOT
Copyright AoPS Incorporated. This page is copyrighted material. You can view and print this page for your own use, but you
cannot share the contents of this file with others.
Class Transcript 01/21 - Modular Arithmetic B
nsato 7:30:52 pm
WOOT 2012-13: Modular Arithmetic B
nsato 7:30:57 pm
In today's lecture, we will continue our look at number theory and modular arithmetic. The first half of our class will focus on the use
of Fermat's Little Theorem and Euler's Theorem. In the second half, we'll cover some more general number theory problems that
are typical for this level.
nsato 7:31:09 pm
We'll start with a nice warm-up exercise.
nsato 7:31:14 pm
nsato 7:31:35 pm
How can we find the missing digit?
nsato 7:32:25 pm
We can try to find the sum of the 9 digits. If all 10 digits were present, then their sum would be 0 + 1 + 2 + .. . + 9 = 45. However, we
can't find the sum of the 9 digits without computing 2^29. Is there an easier way?
delta1 7:33:00 pm
mod 9
Dunedubby 7:33:00 pm
find the number mod 9
Dunedubby 7:33:00 pm
the number mod 9 is the same as the sum of the digits mod 9
A123456789 7:33:00 pm
Compute 2^29 (mod 9).
aleph0 7:33:00 pmmod 9
Binomial-theorem 7:33:00 pm
Find the number modulo 9 to figure out which number we do not have in our sum
brian22 7:33:02 pm
mod 9!
nsato 7:33:06 pm
We know that a number and the sum of its digits are congruent modulo 9, so we can reduce 2^29 modulo 9. What do we get?
AndroidFusion 7:34:08 pm
5
willwang123 7:34:08 pm
5
ProbaBillity 7:34:08 pm
5
zheng 7:34:08 pm
5
mjseaman1 7:34:14 pm
5
bestbearever 7:34:14 pm
5
Binomial-theorem 7:34:18 pm
phi(9)=6, therefore 2^(29)=2^5=32=5(mod 9)
8/13/2019 10 - Modular Arithmetic
2/116
nsato 7:34:20 pm
nsato 7:34:39 pm
So what is the missing digit?
mcdonalds106_7 7:35:25 pm
4
s.homberg 7:35:25 pm
4
math-fan 7:35:25 pm
4
distortedwalrus 7:35:25 pm
4
zheng 7:35:34 pm
4
PiCrazy31415 7:35:34 pm
4
mjseaman1 7:35:34 pm
4
MathisFun! 7:35:34 pm
4
Binomial-theorem 7:35:34 pm
4!
nsato 7:35:47 pm
The missing digit must be congruent to -5 modulo 9, so the missing digit is 4.
ProbaBillity 7:36:01 pm
and indeed it is 4; 2^29 = 536870912.
nsato 7:36:03 pm
Indeed, 2^29 = 536870912. All digits are present except 4.
nsato 7:36:16 pm
nsato 7:36:28 pm
How do we start?
ProbaBillity 7:37:01 pm
mod 1000
trophies 7:37:01 pm
reduce it modulo 1000
bobcat120 7:37:01 pm
take it mod 1000
PiCrazy31415 7:37:01 pm
modulo 1000
bestbearever 7:37:01 pm
mod 1000
nsato 7:37:04 pm
Finding the last three digits of a number is an indication to work modulo 1000.
nsato 7:37:10 pm
nsato 7:37:14 pm
How can we reduce this?
pgmath 7:37:53 pm
Euler's Theorem
ProbaBillity 7:37:53 pm
8/13/2019 10 - Modular Arithmetic
3/116
Euler's theorem
nsato 7:38:15 pm
We can use Euler's Theorem.
trophies 7:38:20 pm
9^400= 1(mod 1000) by euler's theorem
A123456789 7:38:20 pm
9^400=1(mod 100), so compute 8^7(mod 400).
distortedwalrus 7:38:20 pm
note that 9^400 == 1 (mod 1000)
nsato 7:38:30 pm
mentalgenius 7:38:44 pm
well phi(1000) = 400, so we want 8^7 mod 400
Dunedubby 7:38:44 pm
find 8^7 mod phi(1000)
nsato 7:38:54 pm
nsato 7:39:02 pm
How can we do this?
diger 7:40:20 pm
eulers theorem again
distortedwalrus 7:40:20 pm
use euler's theorem again
nsato 7:40:22 pm
Euler's Theorem doesn't help, because the exponent 7 is far less than phi(400).
brian22 7:40:31 pm
8^3*8^3*8
trophies 7:40:31 pm
Note that 8^3=512= 112(mod 400). Thus, we have 112*112*8= 112*96= 352(mod 1000)
nsato 7:40:44 pm
Probably the easiest way to compute this is to look at the first few powers of 8 modulo 400. We do this by starting with 1, then
multiplying each term by 8 and reducing modulo 400.
nsato 7:41:05 pm
This gives us 1, 8, 64, 112, 96, 368, 144, 352.
nsato 7:41:16 pm
(Or we can combine powers, as suggested above.)
mentalgenius 7:41:28 pm
8^3 = 512 112 (mod 400)
nsato 7:41:37 pm
nsato 7:41:56 pm
How can we compute this residue?
nsato 7:42:29 pm
We have gone as far as we can with Euler's Theorem. We can try to compute this by looking at the first few powers of 9 modulo
1000, but there is an easier way.
nsato 7:42:50 pm
Note that 9 is close to 10, and 1000 = 10^3. Can we exploit this fact somehow?
trophies 7:43:28 pm
binomial theorem!
TheLittleOne 7:43:28 pm
8/13/2019 10 - Modular Arithmetic
4/116
8/13/2019 10 - Modular Arithmetic
5/116
nsato 7:47:03 pm
We use the prime factorization of 30 = 2 x 3 x 5. Hence, it suffices to show that n^5 - n is divisible by 2, 3, and 5, for all integers n.
nsato 7:47:22 pm
Is n 5 - n divisible by 2?
ProbaBillity 7:48:20 pm
yes, we test both 0 and 1 and they work mod 2.
bobcat120 7:48:20 pm
yes, n^5 and n are the same parity
pgmath 7:48:20 pm
Yes, n^5 and n have the same parity
trophies 7:48:20 pm
Yes... we can check 1(mod 2) and 0(mod 2), which both work.
zheng 7:48:20 pm
Yes. If n is odd we get odd-odd=even. If n is even we get even-even=even
Showpar 7:48:20 pm
Yes, n^5 and n have the same modulo 2 residue
mentalgenius 7:48:20 pm
two cases - n even or n odd; if n even, trivial; if n odd, 1-1 0 (mod 2), so yes
aleph0 7:48:20 pm
n^5 and n must have same parity
nsato 7:48:23 pm
Yes. By reducing modulo 2, we can check for n = 0 and n = 1.
nsato 7:48:26 pm
Is n 5 - n divisible by 3?
ProbaBillity 7:49:20 pm
0, 1, and 2 work. So it is.
trophies 7:49:20 pm
Yes, we can check 0(mod 3), 1(mod 3), and 2(mod 3)
mjseaman1 7:49:20 pm
Yes check n==0,1,2 mod 3
distortedwalrus 7:49:20 pmyes by checking 0, 1, and 2
binmu 7:49:20 pm
yes, check 0, 1 and 2(mod3)
nsato 7:49:24 pm
Yes. By reducing modulo 3, we can check for n = 0, 1, and 2.
nsato 7:49:27 pm
Is n 5 - n divisible by 5?
ProbaBillity 7:50:15 pm
0, 1, 2, 3, and 4 work. Thus 5|n^5 - n. And we are done!
pgmath 7:50:15 pm
Yes, by FLT
zheng 7:50:15 pm
Fermat's little gives n-n so yes
PiCrazy31415 7:50:15 pm
yes, fermat's little theorem
brian22 7:50:15 pm
by Fermat's litt le theorem
Binomial-theorem 7:50:15 pm
mjseaman1 7:50:15 pm
Yes by Fermat
8/13/2019 10 - Modular Arithmetic
6/116
trophies 7:50:15 pm
Yes, we can use Fermat's little theorem... n^5=n(mod 5)-n(mod 5)= 0(mod 5)
diger 7:50:15 pm
fermats little theorem
nsato 7:50:18 pm
Yes. By reducing modulo 5, we can check for n = 0, 1, 2, 3, and 4. We can also simply cite Fermat's Little Theorem for the prime p =
5.
nsato 7:51:04 pm
Hence, n^5 - n is divisible by 2 x 3 x 5 = 30 for all integers n.
nsato 7:51:09 pm
This simple problem illustrates an important principle. If you want to prove that a number is divisible by n, it helps to look at the
individual prime powers of n.
nsato 7:51:33 pm
nsato 7:52:25 pm
We can start by trying to reduce the given expression modulo 2000, but all the bases are already less than 2000. So what else can
we do?
ProbaBillity 7:53:37 pm
divisible by 16 and 125
zheng 7:53:37 pm
use mod 16 and mod 125
brian22 7:53:37 pm
mod 16 and 125
pgmath 7:53:37 pm
modulo 2^4 = 16 and 5^3 = 125
mjseaman1 7:53:37 pm
Reduce it mod 16 and 125. If it is zero mod both, it is divisible by 2000.
distortedwalrus 7:53:37 pm
note that 2000=2^4*5^3
Binomial-theorem 7:53:37 pm
2000=2*1000=2^4*5^3 look mod 16 and mod 125
nsato 7:53:49 pm
The prime factorization of 2000 is 2 4 x 5^3, so we look at the factors 2 4 = 16 and 5^3 = 125 separately.
nsato 7:54:00 pm
How does the given expression reduce modulo 16?
PiCrazy31415 7:55:21 pm
0 modulo 16
diger 7:55:21 pm
9^n - 9^n +12^n -(-4)^n == 0
Binomial-theorem 7:55:21 pm9^n-9^n+(-4)^n-(-4)^n=0(mod 16) YAY!
brian22 7:55:21 pm
0
zheng 7:55:21 pm
9^n-9^n+12^n-12^n=0
distortedwalrus 7:55:21 pm
it's 0 (mod 16)
tc1729 7:55:25 pm
9^n - 9^n + 12^n - 12^n = 0
nsato 7:55:31 pm
8/13/2019 10 - Modular Arithmetic
7/116
nsato 7:55:40 pm
Therefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 16.
nsato 7:55:51 pm
How does the given expression reduce modulo 125?
mentalgenius 7:56:59 pm
0
pgmath 7:56:59 pm
bestbearever 7:56:59 pm
0 mod 125 (cancels)
Binomial-theorem 7:56:59 pm
(-4)^n-25^n+25^n-(-4)^n so again 0
PiCrazy31415 7:56:59 pm
0 modulo 125
tc1729 7:56:59 pm
121^n - 25^n + 25^n -121^n = 0 (mod 125)
trophies 7:56:59 pm
121^n-25^n+25^n-121^n= 0(mod 125).
zheng 7:56:59 pm
(-4)^n-25^n+25^n-(-4)^n=0
A123456789 7:56:59 pm
(-4)^n-25^n+25^n-(-4)^n
Showpar 7:56:59 pm
(-4)^n-25^n+25^n-(-4)^n
ProbaBillity 7:57:03 pm
(-4^n) - 25^n + 25^n - (-4^n) 0 (mod 25) DOUBLE YAY! WE DONE! that was really nice.
nsato 7:57:07 pm
nsato 7:57:18 pm
Therefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 125.
nsato 7:57:27 pm
We conclude that 121 n - 25^n + 1900 n - (-4)^n is divisible by 2000 for all positive integers n.
nsato 7:57:51 pm
Again, all we had to do was look at individual prime powers, which helps break down the expression.
nsato 7:58:02 pm
nsato 7:58:14 pm
What can we do with this equation?
nsato 7:59:22 pm
All those fifth powers... does that remind us anything?
8/13/2019 10 - Modular Arithmetic
8/116
Dunedubby 7:59:52 pm
take it mod 30!
ProbaBillity 7:59:52 pm
n^5 n (mod 30)
Dunedubby 7:59:52 pm
we know that n^5 == n mod 30
nsato 8:00:12 pm
We've shown that n^5 is congruent to n modulo 30, so we can reduce the given equation modulo 30. What does that tell us about n
ProbaBillity 8:01:57 pm
n 24 (mod 30)
mentalgenius 8:01:57 pm
n 24 (mod 30)
zheng 8:01:57 pm
n=133+110+84+27=24 (mod 30)
steve314 8:01:57 pm
n==24 mod 30
brian22 8:01:57 pm
13+20+24+27==22==n mod 30
nsato 8:02:09 pm
nsato 8:03:04 pm
That helps narrow down the possible values of n. What else can we do to help find n?
ged3.14 8:03:56 pm
use units digits along with bounding
Showpar 8:03:56 pm
Set bounds on n.
ged3.14 8:04:01 pm
then bound n
Dunedubby 8:04:01 pm
set an upper bound and lower bound
nsato 8:04:02 pm
Let's try to find some bounds on n. What's one obvious bound for n?
PiCrazy31415 8:04:57 pm
larger than 133
zheng 8:04:57 pm
n>133
steve314 8:04:57 pm
n>133
Showpar 8:04:57 pmn>133
flappingwings 8:04:57 pm
n is definitely greater than 133
diger 8:04:57 pm
n>133
bestbearever 8:04:57 pm
greater than 133
Binomial-theorem 8:04:57 pm
n>133
yangdongyan 8:04:57 pm
n>133
8/13/2019 10 - Modular Arithmetic
9/116
nsato 8:04:59 pm
Clearly n > 133.
nsato 8:05:11 pm
Now we need to find an upper bound on n.
nsato 8:05:32 pm
The largest term in the left-hand side is 133^5, so we compare all the other terms to 133^5.
nsato 8:05:42 pm
We know that 110^5 < 133^5.
nsato 8:05:53 pm
Can we compare 84^5 + 27 5 and 133^5?
PiCrazy31415 8:07:17 pm
84^5 + 27^5 < 133^5
flappingwings 8:07:17 pm
since 84+27 is less than 133, the former is less than the latter
Dunedubby 8:07:17 pm
84^5 + 27^5 < (84 + 27)^5 < 133^5
King6997 8:07:17 pm
84^5+27^5 < 133^5
tc1729 8:07:17 pm
distortedwalrus 8:07:17 pm
well it's less than (84+27)^5=111^5
Showpar 8:07:19 pm
84^5+27^5
8/13/2019 10 - Modular Arithmetic
10/116
5^5 and 4^5
ProbaBillity 8:12:48 pm
3125/1024
steve314 8:12:51 pm
5^5/4^5
distortedwalrus 8:12:51 pm
yeah 5^5/4^5
tc1729 8:12:55 pm
5^5/4^5
nsato 8:13:01 pm
We see that 5^5/4 5 = 3125/1024 is approximately 3.
nsato 8:13:14 pm
Even better, this ratio is slightly larger than 3, which means we can use this ratio to get an upper bound on n:
nsato 8:13:27 pm
nsato 8:13:41 pm
Therefore, n < 5/4 x 133 = 166 + 1/4.
nsato 8:14:06 pm
We also know that n > 133 and n is congruent to 24 modulo 30. Do we have enough information to determine n?
trophies 8:14:58 pm
thus, n must be 144
bestbearever 8:14:58 pm
144
AndroidFusion 8:14:58 pm
n = 144
mjseaman1 8:14:58 pm
Yes n is 144
Binomial-theorem 8:14:58 pm
n=144, 174, ... but 174>166 so n=144
mentalgenius 8:14:58 pm
yes, n = 144
A123456789 8:14:58 pm
n=144
nsato 8:15:01 pm
The only n satisfying 133 < n < 166 + 1/4, and n congruent to 24 modulo 30 is n = 144.
nsato 8:15:39 pm
nsato 8:16:03 pm
What makes this sum difficult to deal with?
ProbaBillity 8:17:17 pm
the absolute values
delta1 8:17:17 pm
absolute value
diger 8:17:17 pm
absolute values
math-fan 8:17:17 pm
all absolute values
8/13/2019 10 - Modular Arithmetic
11/116
8/13/2019 10 - Modular Arithmetic
12/116
8/13/2019 10 - Modular Arithmetic
13/116
trophies 8:27:27 pm
k=1(mod 2), or in other words, k is odd.
steve314 8:27:27 pm
k is odd
Showpar 8:27:27 pm
LHS must be even, so k is odd
mjseaman1 8:27:27 pm
k is odd
nsato 8:27:31 pm
The left-hand side must be even. Therefore, 5k must be odd, which means k must be odd.
nsato 8:27:44 pm
Let k = 2n + 1 for some integer n.
nsato 8:27:47 pm
Now what?
bestbearever 8:28:55 pm
combine that with the very first 5994-5k
binmu 8:28:55 pm
plug back in
AndroidFusion 8:28:55 pm
so 5994 - 5k = 5989 - 10k is congruent to 9 mod 10
ProbaBillity 8:28:55 pm
plug it in
willwang123 8:28:55 pm
substitute that in
binmu 8:28:55 pm
5994-5(2n+1)=5994-10n+5==9(mod10)
Dunedubby 8:29:00 pm
so we're done! - plugging in the first equation 5994 - 5k means that it must end in a 9
nsato 8:29:02 pm
We can substitute into the equation above, to get
nsato 8:29:06 pm
nsato 8:29:28 pm
It looks like we can conclude that this number always ends in 9, but there is a small catch. What's the catch?
ProbaBillity 8:30:26 pm
we must verify that n is less than 599
A123456789 8:30:26 pm
It could be negative.
willwang123 8:30:26 pm
or if n>=599
Calebhe1290 8:30:26 pm
5989
8/13/2019 10 - Modular Arithmetic
14/116
mjseaman1 8:31:45 pm
The sum is positive because it the sum of absolute values each of which is 1 or 6.
s.homberg 8:31:45 pm
each b_i > a_i, so the sum must be positive
Dunedubby 8:31:51 pm
absolute value
nsato 8:31:58 pm
The original sum was expressed as a sum of absolute values, which must be nonnegative. And a nonnegative number of the form
5989 - 10n must end in 9, so we are home free.
ProbaBillity 8:32:07 pm
But it is, since 2n + 1 = k
8/13/2019 10 - Modular Arithmetic
15/116
bobcat120 8:42:14 pm
x must be odd
AndroidFusion 8:42:14 pm
x is odd
nsato 8:42:17 pm
The number 2d - 1 is always odd, so x is odd.
nsato 8:42:36 pm
Since x is odd, what can we do?
Calebhe1290 8:43:27 pm
write it as 2n+1
PiCrazy31415 8:43:27 pm
let x = 2n+1
Dunedubby 8:43:27 pm
express as 2n + 1
willwang123 8:43:27 pm
say it's 2n+1
binmu 8:43:27 pm
x=2n+1
A123456789 8:43:27 pm
x=2n+1
AndroidFusion 8:43:27 pm
substitute it for 2n+1
nsato 8:43:30 pm
Whenever we find some fact like this, we express it algebraically.
nsato 8:43:36 pm
Let x = 2n + 1 for some integer n. Then 2d - 1 = x^2 = (2n + 1)^2 = 4n 2 + 4n + 1.
zheng 8:44:41 pm
d=2n^2+2n+1
ProbaBillity 8:44:41 pm
so d = 2n^2 + 2n + 1. Time to plug more things in!
Binomial-theorem 8:44:41 pmd=2n^2+2n+1
soy_un_chemisto 8:44:41 pm
then d is 2n^2 + 2n + 1
Dunedubby 8:44:41 pm
therefore d = 2n^2 + 2n + 1
nsato 8:44:46 pm
Then d = 2n 2 + 2n + 1. What does this tell us about d?
esque 8:45:42 pm
d is odd
distortedwalrus 8:45:42 pm
d is odd
soy_un_chemisto 8:45:42 pm
d is odd
Calebhe1290 8:45:42 pm
d is odd
zheng 8:45:42 pm
d is odd
nsato 8:45:51 pm
This equation says that d is odd.
nsato 8:45:57 pm
Then what can we say about 5d - 1 = y^2 and 13d - 1 = z^2?
8/13/2019 10 - Modular Arithmetic
16/116
pgmath 8:46:50 pm
5d -1 and 13d - 1 are both even
delta1 8:46:58 pm
y and z are even
Binomial-theorem 8:46:58 pm
y and z are even
Showpar 8:46:58 pm
y and z are both even
mjseaman1 8:46:58 pm
y and z are even
bestbearever 8:46:58 pm
y and z are even
mentalgenius 8:46:58 pm
y and z are both even
nsato 8:47:04 pm
Since d is odd, 5d - 1 = y^2 and 13d - 1 = z^2 are even. Hence, y and z are even.
nsato 8:47:25 pm
Again, let's express these statements algebraically, by introducing variables.
brian22 8:47:44 pm
y=2k, z=2j
nsato 8:47:52 pm
Let y = 2u and z = 2v. Then 5d - 1 = y^2 = 4u 2 and 13d - 1 = 4v^2.
nsato 8:48:03 pm
What can we do with these equations?
delta1 8:49:01 pm
subtract them
A123456789 8:49:01 pm
Subtract the first from the second.
diger 8:49:01 pm
subtract
binmu 8:49:01 pmsubtract
Calebhe1290 8:49:01 pm
subtract
ProbaBillity 8:49:01 pm
subtract them
pgmath 8:49:06 pm
subtract the first from the second
nsato 8:49:07 pm
We can subtract them, to get 8d = 4v^2 - 4u^2, so 2d = v^2 - u^2.
nsato 8:49:18 pm
What can we do with this equation?
brian22 8:50:15 pm
factor!
willwang123 8:50:15 pm
diff of squares
binmu 8:50:15 pm
2d=(v+u)(v-u)
Calebhe1290 8:50:15 pm
factor the rhs
PiCrazy31415 8:50:15 pm
factorize
8/13/2019 10 - Modular Arithmetic
17/116
soy_un_chemisto 8:50:17 pm
factor the right side
nsato 8:50:19 pm
We can factor the right-hand side, to get 2d = (v + u)(v - u).
nsato 8:50:25 pm
Can we say anything interesting about the factors v + u and v - u?
steve314 8:51:19 pm
they have the same parity
Dunedubby 8:51:19 pm
they are of the same parity
diger 8:51:19 pm
same parity
vjnmath 8:51:19 pm
They must be the same parity
Binomial-theorem 8:51:19 pm
same parity
pgmath 8:51:19 pm
they have the same parity
ProbaBillity 8:51:24 pm
same parity
brian22 8:51:24 pm
same parity
nsato 8:51:28 pm
Either v + u and v - u are both even or both odd (since their difference 2u is an even number).
nsato 8:51:55 pm
What happens if both v + u and v - u are even?
binmu 8:52:47 pm
2d is divisible by 4
bestbearever 8:52:47 pm
2d is congruent to 0 mod 4
zheng 8:52:47 pmthen we have that d must be even, contradiction
distortedwalrus 8:52:47 pm
both sides are multiples of 4, so d is even
PiCrazy31415 8:52:47 pm
then 2d is divisible by 4, but d is odd
diger 8:52:47 pm
2d is a multiple of 4 and d is even
willwang123 8:52:47 pm
d is even too
cire_il 8:52:47 pm
then it means d is even
Binomial-theorem 8:52:47 pm
then d is even, but that's a contradiction
Dunedubby 8:52:47 pm
then d is even, a contradiction
nsato 8:52:53 pm
If both v + u and v - u are even, then 2d = (v + u)(v - u) is a multiple of 4, which is impossible because d is odd.
nsato 8:53:03 pm
What happens if both v + u and v - u are odd?
ProbaBillity 8:53:56 pm
another contradict ion. LHS is 2d which is even, RHS is odd.
8/13/2019 10 - Modular Arithmetic
18/116
diger 8:53:56 pm
2d is odd
bestbearever 8:53:56 pm
2d must be odd
PiCrazy31415 8:53:56 pm
then 2d is odd, contradiction
binmu 8:53:56 pm
2d is odd too
Binomial-theorem 8:53:56 pm
then 2d must be odd, absurd again
tc1729 8:53:56 pm
d is odd
Showpar 8:53:56 pm
The RHS is odd, while the LHS is even, contradiction
nsato 8:54:00 pm
If both v + u and v - u are odd, then 2d = (v + u)(v - u) is odd, which is again impossible because 2d is even.
nsato 8:54:22 pm
We have obtained a contradiction, so at least one of 2d - 1, 5d - 1, and 13d - 1 is not a perfect square.
nsato 8:54:41 pm
It can seem simple, but using parity can be a powerful tool. And whenever you find that a number is even (odd resp.), it is usually a
good idea to write it in the form 2n (2n + 1 resp.).
nsato 8:54:54 pm
nsato 8:55:19 pm
You may recall Euclid's proof that there are an infinite number of primes. How can we start?
Binomial-theorem 8:55:58 pm
contradiction again!
tc1729 8:55:58 pm
assume there are only finitely many
PiCrazy31415 8:55:58 pm
proof by contradiction
A123456789 8:55:58 pm
Contradiction.
bestbearever 8:55:58 pm
assume there are a finite number
distortedwalrus 8:55:58 pm
we can use a contradiction again
nsato 8:56:03 pm
We argue by contradiction.
zheng 8:56:08 pm
assume there are finite primes of the form 3n+2
nsato 8:56:10 pm
nsato 8:56:23 pm
Then what?
willwang123 8:57:00 pm
multiply them
mentalgenius 8:57:00 pm
multiply them all together and see what you get
nsato 8:57:05 pm
8/13/2019 10 - Modular Arithmetic
19/116
8/13/2019 10 - Modular Arithmetic
20/116
Is there any way to fix this argument?
Binomial-theorem 9:04:31 pm
Consider 3p_1p_2p_3...p_k-1
nsato 9:04:36 pm
tc1729 9:05:07 pm
then it has to be 2 mod 3
nsato 9:05:10 pm
Then P always reduces to 2 modulo 3, and it is relatively prime to all the p_i, so the argument that we used above now works.
nsato 9:05:28 pm
More generally, if a and b are relatively prime positive integers, then there are infinitely many primes of the form an + b. This result
is known as Dirichlet Theorem, but it is an advanced result and is difficult to prove.
nsato 9:06:24 pm
The idea of Euclid's proof is also useful for the following problem.
nsato 9:06:30 pm
Binomial-theorem 9:07:11 pm
that looks complex
nsato 9:07:12 pm
It looks hard; we just have to take things one step at a time.
nsato 9:08:19 pm
Let's start by looking at small primes. Is the prime 2 in M?
nsato 9:08:51 pm
Since M contains at least three primes, there is an odd prime in M, say p. Let A = {p}. Then by the condition in the problem, all the
prime factors of p - 1 are also in M.
binmu 9:09:46 pm
so yes 2 is in M
zheng 9:09:46 pm
Since p is odd, p-1 is even so 2 must be in M
Calebhe1290 9:09:46 pm
p-1 is even, so 2 must be in M
mentalgenius 9:09:52 pm
so 2 has to be in m
nsato 9:09:56 pm
But p - 1 is even, so 2 is in M.
nsato 9:10:22 pm
Can we show that 3 must be in M? Would cases would easily lead to 3 being in M?
Dunedubby 9:11:21 pm
3n + 1 prime
math-fan 9:11:21 pm
primes that are equal to 1 mod 3
Binomial-theorem 9:11:21 pm
p=1(mod 3)
nsato 9:11:28 pm
If M contains a prime of the form p = 3n + 1, then take A = {p}. Then all the factors of p - 1 = 3n are also in M, so 3 is in M.
nsato 9:12:46 pm
8/13/2019 10 - Modular Arithmetic
21/116
Otherwise, M contains two primes of the form 3n + 2, say p and q. What should we take the set A as in this case?
Dunedubby 9:13:20 pm
and if not, then the product of two 3n + 2s
capu 9:13:33 pm
If there is p congruent to 1 mod 3 then done (A= that prime). If not then there are two primes congruent to 2 mod 3 then A= those two and
done. Therefore 3 is in M
zheng 9:13:33 pm
{2, p} or {2,q}
diger 9:13:33 pm
A = {p,q}
ProbaBillity 9:13:33 pm
{p, q}
nsato 9:13:40 pm
We can take A = {p, q}. Then all the prime factors of pq - 1 are also in M.
mentalgenius 9:13:55 pm
pq 1 (mod 3), so 3 is guaranteed to be in M
nsato 9:13:56 pm
But pq - 1 is congruent to 2 x 2 - 1 = 3, or 0 modulo 3, so pq - 1 is divisible by 3. Therefore, 3 is in M. In either case, 3 is in M.
nsato 9:14:39 pm
So now we know that 2 and 3 must be in M, which is a great start. What does this tell us?
Dunedubby 9:15:42 pm
and {2, 3} so 5 is in M as well
distortedwalrus 9:15:42 pm
5=2*3-1 is in M
diger 9:15:42 pm
5 must be in M for when A = {2,3}
Binomial-theorem 9:15:42 pm
5 is in M, becuase -1+2*3=5
zheng 9:15:42 pm
2*3-1=5 so 5 must be in M
nsato 9:15:44 pm
Taking A = {2,3}, we see that 5 must be in M.
nsato 9:15:56 pm
So now we have 2, 3, and 5. Anything else?
ProbaBillity 9:16:36 pm
7 is in M, because 3*5 - 1 = 14 which has 7 as a prime factor
Dunedubby 9:16:36 pm
and {3, 5} so 7
zheng 9:16:36 pm
A={3,5} gives that 7 must be in M
diger 9:16:36 pm
if A = {3,5} we get 7
soy_un_chemisto 9:16:36 pm
3 * 5 - 1 = 14 so 7 must also be in M
binmu 9:16:36 pm
7 is in M, 5*3-1=14
steve314 9:16:36 pm
3*5-1 =14=2*7 so 7 is also in m
Calebhe1290 9:16:36 pm
7, {3,5}
yankeesfan 9:16:36 pm
3*5-1=14 so 7
8/13/2019 10 - Modular Arithmetic
22/116
nsato 9:16:39 pm
Taking A = {3,5}, we see that 7 must be in M.
nsato 9:17:01 pm
Hence, the first few primes are in M. We want to prove that M contains all primes.
Binomial-theorem 9:17:11 pm
we can follow this logic, can't we?
nsato 9:17:40 pm
We can generate more primes, but we'll need a general approach. Obviously, we can't do this every prime!
nsato 9:17:55 pm
But primes are hard to get a hold of.
nsato 9:17:58 pm
What intermediate result can we try proving first?
nsato 9:18:15 pm
(Here, you might think of Euclid's proof...)
PiCrazy31415 9:18:46 pm
M is infinite?
binmu 9:18:46 pm
infinite number of primes in M
mentalgenius 9:18:46 pm
there are an infinite number of primes in M
Dunedubby 9:18:46 pm
there an infinite number of primes in M
diger 9:18:46 pm
M has infinite elements
aleph0 9:18:46 pm
M is infinite
nsato 9:18:54 pm
Let's try proving first that M is infinite.
nsato 9:19:03 pm
nsato 9:19:26 pm
As a start, let's take A to be all the primes in M, except one, say p_i. (Remember that A must be a proper subset of M.)
nsato 9:19:42 pm
nsato 9:20:01 pm
pgmath 9:20:58 pm
It is an integer power of p_i
diger 9:20:58 pm
it is a power of p_i
aleph0 9:20:58 pm
it's a power of p_i
delta1 9:20:58 pm
it is some power of p_i
nsato 9:21:06 pm
8/13/2019 10 - Modular Arithmetic
23/116
8/13/2019 10 - Modular Arithmetic
24/116
nsato 9:24:22 pm
Let's start analyzing this equation.
nsato 9:24:38 pm
nsato 9:24:47 pm
Also, P is at least 2 x 3 x 5 x 7. So what can we say about a?
mjseaman1 9:27:35 pm
PiCrazy31415 9:27:35 pm
a7
Calebhe1290 9:27:35 pm
a is at least 7
ProbaBillity 9:27:35 pm
a is at least 7
nsato 9:28:05 pm
nsato 9:28:10 pm
nsato 9:28:26 pm
So what can we say about b?
brian22 9:29:14 pm
b=1
mjseaman1 9:29:14 pm
b=1
delta1 9:29:14 pm
it is 1
capu 9:29:14 pm
b=1
PiCrazy31415 9:29:14 pm
b=1
diger 9:29:14 pm
divide by 2 to see b=1
nsato 9:29:23 pm
Right, because 2^a - 2 has exactly one factor of 2.
nsato 9:29:35 pm
nsato 9:29:41 pm
How can we analyze this equation?
PiCrazy31415 9:30:28 pm
modulo 3
AndroidFusion 9:30:28 pm
mod 3
8/13/2019 10 - Modular Arithmetic
25/116
nsato 9:30:29 pm
We can try reducing modulo 3.
nsato 9:30:35 pm
nsato 9:31:03 pm
What does this congruence tell us about a?
soy_un_chemisto 9:31:30 pm
so a is odd
mentalgenius 9:31:30 pm
a is odd
A123456789 9:31:30 pm
a is odd.
distortedwalrus 9:31:30 pm
a is odd
Showpar 9:31:30 pm
a is odd
trophies 9:31:30 pm
a is odd
cire_il 9:31:30 pm
a is odd
ProbaBillity 9:31:34 pm
a = 2n+1
nsato 9:31:38 pm
This congruence tells us that a - 1 is even. Let a - 1 = 2n.
nsato 9:31:48 pm
nsato 9:31:55 pm
What can we do with this equation?
distortedwalrus 9:32:44 pm
factor as difference of sqaures
binmu 9:32:44 pm
(2^n-1)(2^n+1)
A123456789 9:32:44 pm
Factor the right side of the equation.
nsato 9:32:47 pm
nsato 9:32:52 pm
What does this equation say?
delta1 9:33:41 pm
the two factors are both powers of 3
mjseaman1 9:33:41 pm
Both of the factors on the RHS are powers of 3
nsato 9:33:52 pm
This equation says that both 2^n + 1 and 2^n - 1 are powers of 3.
nsato 9:33:57 pm
But (2^n + 1) - (2^n - 1) = 2.
Calebhe1290 9:34:20 pm
only 3 and 1 would work
8/13/2019 10 - Modular Arithmetic
26/116
Dunedubby 9:34:31 pm
that 2^n + 1 and 2^n - 1 are both powers of 3, so n = 1
A123456789 9:34:31 pm
n=1.
soy_un_chemisto 9:34:31 pm
2^n + 1 and 2^n - 1 must be powers of 3, but this is only satisfied when n = 1
delta1 9:34:31 pm
so n=1
ProbaBillity 9:34:31 pm
n = 1
nsato 9:34:40 pm
The only powers of 3 that differ by 2 are 3 and 1, so n = 1, and a = 3.
King6997 9:35:12 pm
but a>=7
binmu 9:35:12 pm
but a must be greater than 7
zheng 9:35:12 pm
hoever a>=7
nsato 9:35:14 pm
But a is at least 7, which is a contradiction.
nsato 9:35:21 pm
Therefore, M contains an infinite number of primes.
nsato 9:35:27 pm
We're actually very close to the end now.
nsato 9:35:32 pm
nsato 9:36:06 pm
We want to show that p is a factor of some product, minus 1. Does this remind us of any results?
nsato 9:37:28 pmWe could try using Fermat's Little Theorem.
nsato 9:37:37 pm
nsato 9:38:37 pm
nsato 9:39:04 pm
Binomial-theorem 9:39:36 pm
if p_1=p_2=...p_k=a(mod p)?
AndroidFusion 9:39:36 pm
let k = p-1 and p1, p2, ... pk be congruent mod p
nsato 9:39:48 pm
nsato 9:40:12 pm
The primes p_1, p_2, ..., p_{p - 1} must also be distinct from p. But if p was in M, then this argument would not be necessary in the
first place.
nsato 9:40:50 pm
How do we know that there exist p - 1 primes in M that are congruent modulo p?
8/13/2019 10 - Modular Arithmetic
27/116
Dunedubby 9:41:38 pm
then use pigeonhole principle - with infinite pigeons
AndroidFusion 9:41:38 pm
there are an infinite number of primes, so use pidgeon principle
Dunedubby 9:41:38 pm
by the pigeonhole principle, with infinite pigeons, then at least p-1 must be in some a mod p (where a /== 0)
aleph0 9:41:38 pm
there are an infinite number, so by pigeonhole
AndroidFusion 9:41:38 pm
*pigeonhole principle
mjseaman1 9:41:52 pm
M has infinitely many primes, so the pigeonhole principle works
nsato 9:41:53 pm
We have shown that the set M is infinite.
nsato 9:42:00 pm
Hence, if we reduce every element in M modulo p, then some nonzero residue must appear an infinite number of times.
nsato 9:42:16 pm
Then we simply take p - 1 primes p_1, p_2, ..., p_{p - 1} that have this residue.
nsato 9:42:35 pm
Therefore, M contains every prime p.
nsato 9:42:49 pm
SUMMARY
nsato 9:42:51 pm
In today's class, we saw how to effectively use Fermat's Little Theorem and Euclid's Theorem. We also saw the power of algebra in
number theory problems. We can solve many number theory problems effectively by putting a number in the right form (like
expressing an even number in the form 2n), and using factorization. When you see a number theory problem, convert the words
into mathematics, and let the equations do the work.
nsato 9:43:06 pm
Finally, we also saw how to solve problems using argument by contradiction. If a problem asks you to prove that something cannot
occur, this is usually a good sign to use contradiction.
nsato 9:43:14 pm
That's it for today's class.
Copyright AoPS Incorporated. This page is copyrighted material. You can view and print this page for your own use, but you
cannot share the contents of this file with others.
Copyright 2013 AoPS Incorporated. All Rights Reserved.Contact Us Privacy Terms & Conditions
http://www.artofproblemsolving.com/Forum/ucp.php?mode=termshttp://www.artofproblemsolving.com/Company/privacy.phphttp://www.artofproblemsolving.com/Company/contactus.php8/13/2019 10 - Modular Arithmetic
28/116
Art of Problem Solving
WOOT
Copyright AoPS Incorporated. This page is copyrighted material. You can view and print this page for your own use, but you
cannot share the contents of this file with others.
Class Transcript 01/21 - Modular Arithmetic B
Valentin Vornicu 7:31:07 pm
WOOT 2012-13: Modular Arithmetic B
Valentin Vornicu 7:31:16 pm
In today's lecture, we will continue our look at number theory and modular arithmetic. The first half of our class will focus on the use
of Fermat's Little Theorem and Euler's Theorem. In the second half, we'll cover some more general number theory problems that
are typical for this level.
Valentin Vornicu 7:31:24 pm
We'll start with a nice warm-up exercise.
Valentin Vornicu 7:31:29 pm
Valentin Vornicu 7:31:42 pm
How can we find the missing digit?
Cogswell 7:32:03 pmlook mod 9
dinoboy 7:32:03 pm
Use mod 9?
matholympiad25 7:32:03 pm
mod 9!
apple.singer 7:32:03 pm
mod 9?
Valentin Vornicu 7:32:24 pm
We can try to find the sum of the 9 digits. If all 10 digits were present, then their sum would be 0 + 1 + 2 + .. . + 9 = 45. However, we
can't find the sum of the 9 digits without computing 2 29. How is mod 9 going to help us here?
filetmignon821 7:33:21 pmsum of the digits mod 9 is the same as the number itself mod 9
apple.singer 7:33:21 pm
the sum of the digits is congruent to the number itself mod 9
Cogswell 7:33:21 pm
number = sum of digits mod 9
sjaelee 7:33:21 pm
sum of digits is number mod 9
Valentin Vornicu 7:33:28 pm
We know that a number and the sum of its digits are congruent modulo 9, so we can reduce 2^29 modulo 9. What do we get?
BOBBOBBOB 7:34:02 pm
2^3=8=-1mod9
krmathcounts 7:34:02 pm
32 mod 9
filetmignon821 7:34:02 pm
its the same as 2^5 mod 9, which is 5.
antimonyarsenide 7:34:02 pm
5
krmathcounts 7:34:02 pm
5 mod 9
sjaelee 7:34:02 pm
5
8/13/2019 10 - Modular Arithmetic
29/116
Valentin Vornicu 7:34:10 pm
Valentin Vornicu 7:34:12 pm
So what is the missing digit?
Doink 7:35:06 pm
4
Cogswell 7:35:06 pm
4
apple.singer 7:35:06 pm
4
loquidyE 7:35:06 pm
4
Seedleaf 7:35:06 pm
4
jerrytang 7:35:06 pm
4
nikgran 7:35:06 pm
4
duketip10 7:35:06 pm
4
fireonice 7:35:06 pm
4
Valentin Vornicu 7:35:07 pm
The missing digit must be congruent to -5 modulo 9, so the missing digit is 4.
Valentin Vornicu 7:35:11 pm
Indeed, 2^29 = 536870912. All digits are present except 4.
Valentin Vornicu 7:35:20 pm
Valentin Vornicu 7:35:29 pm
How do we start?
Doink 7:36:02 pm
mod 1000
msinghal 7:36:02 pm
mod 1000
yjhan96 7:36:02 pm
mod 1000?
Cogswell 7:36:02 pm
mod 1000
giratina150 7:36:02 pm
mod 1000
Valentin Vornicu 7:36:05 pm
Finding the last three digits of a number is an indication to work modulo 1000.
Valentin Vornicu 7:36:09 pm
Valentin Vornicu 7:36:12 pm
How can we reduce this?
Cogswell 7:36:41 pm
euler's thm
Konigsberg 7:36:41 pm
the euler's theorem
filetmignon821 7:36:41 pm
8/13/2019 10 - Modular Arithmetic
30/116
phi(1000)=400, so we find 8^7 mod 400
Konigsberg 7:36:41 pm
it repeats every 400 times
matholympiad25 7:36:41 pm
we find 8^7 mod phi(1000)
krmathcounts 7:36:41 pm
phi(1000) = 400, and so 9^400 =1 mod 1000
Valentin Vornicu 7:36:49 pm
We can use Euler's Theorem.
Valentin Vornicu 7:36:55 pm
Valentin Vornicu 7:37:01 pm
Valentin Vornicu 7:37:50 pm
Probably the easiest way to compute this is to look at the first few powers of 8 modulo 400. We do this by starting with 1, then
multiplying each term by 8 and reducing modulo 400.
gurev 7:38:05 pm
352
Valentin Vornicu 7:38:09 pmThis gives us 1, 8, 64, 112, 96, 368, 144, 352.
Valentin Vornicu 7:38:15 pm
Valentin Vornicu 7:38:54 pm
We have gone as far as we can with Euler's Theorem. We can try to compute this by looking at the first few powers of 9 modulo
1000, but there is an easier way.
Valentin Vornicu 7:38:58 pm
Is there anything you notice about the number 9 that may make it easier to compute this power modulo 1000?
Doink 7:39:40 pm
9=10-1
krmathcounts 7:39:40 pm
-1 mod 10
MathTwo 7:39:40 pm
10-1
fireonice 7:39:40 pm
10-1
yjhan96 7:39:40 pm
10-1=9
msinghal 7:39:40 pm
9=10-1
MathForFun 7:39:40 pm
9==-1 (mod 10)
Valentin Vornicu 7:40:09 pm
Valentin Vornicu 7:40:17 pm
8/13/2019 10 - Modular Arithmetic
31/116
Valentin Vornicu 7:40:22 pm
Therefore, the last three digits of 9^(8 7) are 081.
Valentin Vornicu 7:40:55 pm
Valentin Vornicu 7:41:18 pm
We could verify that n^5 - n is divisible by 30 for n = 0, 1, 2, ..., 29. But what is an easier way?
duketip10 7:42:38 pm
do 2, 3, 5
briantix 7:42:38 pm
mod 2, 3, 5
jerrytang 7:42:38 pm
Take it mod 2, 3, and 5
fireonice 7:42:38 pm
factor and show it divides 2,3,5
Cogswell 7:42:38 pm
prove that it's divisible by 2, 3, and 5.
msinghal 7:42:38 pmshow it is divisible for 2, 3, 5
apple.singer 7:42:38 pm
show it's divisible by 2, 3, and 5
Valentin Vornicu 7:42:41 pm
We use the prime factorization of 30 = 2 x 3 x 5. Hence, it suffices to show that n^5 - n is divisible by 2, 3, and 5, for all integers n.
Valentin Vornicu 7:43:03 pm
Is n 5 - n divisible by 2?
ashgabat 7:43:12 pm
Yes
gurev 7:43:12 pm
yes
apple.singer 7:43:12 pm
yes
Konigsberg 7:43:12 pm
yes it is
MathForFun 7:43:12 pm
yep
pi.guy3.14 7:43:15 pm
2 is c lear, if n is even, even-even=even, if its odd, odd-odd=even
Valentin Vornicu 7:43:17 pm
Yes. By reducing modulo 2, we can check for n = 0 and n = 1.
Valentin Vornicu 7:43:22 pm
Is n 5 - n divisible by 3?
gurev 7:43:32 pm
yes
Konigsberg 7:43:32 pm
yes
fireonice 7:43:32 pm
yes
loquidyE 7:43:32 pm
yes
Doink 7:43:32 pm
8/13/2019 10 - Modular Arithmetic
32/116
yes
pi.guy3.14 7:43:32 pm
yes, plug in 0,1,2
Valentin Vornicu 7:43:32 pm
Yes. By reducing modulo 3, we can check for n = 0, 1, and 2.
Valentin Vornicu 7:43:37 pm
Is n 5 - n divisible by 5?
pi.guy3.14 7:44:34 pm
yes, plug in 0,1,2,3,4
mrkidney 7:44:34 pm
Yes, by Fermat's little theorem
sjaelee 7:44:34 pm
fermat's
tareyza 7:44:34 pm
yes
duketip10 7:44:34 pm
yes. n^4=1 by fermat's little theorem
BOBBOBBOB 7:44:34 pm
yep
Valentin Vornicu 7:44:40 pmYes. By reducing modulo 5, we can check for n = 0, 1, 2, 3, and 4. We can also simply cite Fermat's Little Theorem for the prime p =
5.
Valentin Vornicu 7:44:46 pm
Hence, n^30 - n is divisible by 2 x 3 x 5 = 30 for all integers n.
Valentin Vornicu 7:44:51 pm
This simple problem illustrates an important principle. If you want to prove that a number is divisible by n, it helps to look at the
individual prime powers of n.
Valentin Vornicu 7:45:06 pm
Valentin Vornicu 7:45:20 pm
We start by trying to reduce the given expression modulo 2000, but all the bases are already less than 2000. So what else can we
do?
fractals 7:46:11 pm
take mod 16 and mod 125
gurev 7:46:11 pm
do mod 16 then mod 125
Cogswell 7:46:11 pm
split 2000 into 16 and 125
apple.singer 7:46:11 pm
factor 2000=2^4*5^3?
aerrowfinn72 7:46:11 pm
taking mod 125 and 16
filetmignon821 7:46:11 pm
2000=2^4*5^3, so we have to prove that our expression is divisible by 16 and 125.
Valentin Vornicu 7:46:13 pm
The prime factorization of 2000 is 2 4 x 5^3, so we look at the factors 2 4 = 16 and 5^3 = 125 separately.
Valentin Vornicu 7:46:16 pm
How does the given expression reduce modulo 16?
jeff10 7:47:56 pm
9^n-9^n+12^n-12^n
8/13/2019 10 - Modular Arithmetic
33/116
loquidyE 7:47:56 pm
9^n - 9^n + 12^n - 12^n == 0 (mod 16)
Seedleaf 7:47:56 pm
12^n - (-4)^n
filetmignon821 7:47:56 pm
it comes out to (-7)^n-(-7)^n+(-4)^n-(-4)^n and everything cancels nicely.
Valentin Vornicu 7:48:03 pm
Valentin Vornicu 7:48:17 pm
Therefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 16.
Valentin Vornicu 7:48:33 pm
Modulo 125 we have a similar situation:
Valentin Vornicu 7:48:40 pm
Valentin Vornicu 7:48:45 pmTherefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 125.
Valentin Vornicu 7:49:23 pm
We conclude that 121 n - 25^n + 1900 n - (-4)^n is divisible by 2000 for all positive integers n.
Valentin Vornicu 7:49:31 pm
Valentin Vornicu 7:50:24 pm
What can we do with this equation?
Cogswell 7:50:49 pm
let's use the problem above: n^5-n (mod 30).
loquidyE 7:50:49 pm
check it for mod 2, 3, 5, etc.
fireonice 7:50:49 pm
take small mods
Valentin Vornicu 7:50:54 pm
We can use a previous problem and reduce it modulo 30. This gives us
Valentin Vornicu 7:50:58 pm
Valentin Vornicu 7:51:06 pm
Now we need to find bounds on n to find its exact value. What's one obvious lower bound on n?
Cogswell 7:52:25 pm
133
fireonice 7:52:25 pm
133
fractals 7:52:25 pm
133
8/13/2019 10 - Modular Arithmetic
34/116
Seedleaf 7:52:25 pm
133
Konigsberg 7:52:25 pm
133
antimonyarsenide 7:52:25 pm
n > 133
jerrytang 7:52:25 pm
133
duketip10 7:52:25 pm
133
Valentin Vornicu 7:52:29 pm
Clearly n > 133.
Valentin Vornicu 7:52:33 pm
Now we need to find an upper bound on n.
Valentin Vornicu 7:53:22 pm
The largest term in the left-hand side is 133^5, so we compare all the other terms to 133^5.
Valentin Vornicu 7:53:25 pm
We know that 110^5 < 133^5.
Valentin Vornicu 7:53:28 pm
Can we compare 84^5 + 27 5 and 133^5?
Konigsberg 7:53:59 pm
yes, it is smaller than 133^5
pi.guy3.14 7:53:59 pm
adding them up, they are still smaller
aerrowfinn72 7:53:59 pm
LHS is definitely smaller
fractals 7:53:59 pm
84 + 27 < 133, so the sum is less than 133^5
filetmignon821 7:53:59 pm
yes, 84^5+27^5
8/13/2019 10 - Modular Arithmetic
35/116
nikgran 7:56:32 pm
4,5
yjhan96 7:56:32 pm
4^5 and 5^5
Valentin Vornicu 7:56:34 pm
We see that 5^5/4^5 = 3125/1024 is approximately 3. Even better, this ratio is slightly larger than 3, which means we can use this
ratio to get an upper bound on n:
Valentin Vornicu 7:57:46 pm
Valentin Vornicu 7:57:54 pm
Therefore, n < 5/4 x 133 = 166 + 1/4.
Valentin Vornicu 7:57:58 pm
So what is n?
nikgran 7:58:17 pm
we see n = 144 is the answer
Konigsberg 7:58:17 pm
144
fractals 7:58:17 pm
144
briantix 7:58:17 pm
144
filetmignon821 7:58:17 pm
144
mrkidney 7:58:17 pm
144
matholympiad25 7:58:17 pm
n is 144
Valentin Vornicu 7:58:39 pm
The only n satisfying 133 < n < 166 + 1/4, and n congruent to 24 modulo 30 is n = 144.
Valentin Vornicu 8:03:38 pm
We had a little situation with the server. Everything seems to be back to normal now.
Valentin Vornicu 8:03:54 pm
Valentin Vornicu 8:04:20 pm
To make things easier, let s(N) denote the sum of the digits of N for a positive integer N. Then A = s(4444^4444) and B = s(A). Let C
= s(B). Then we want to find C.
Valentin Vornicu 8:04:32 pm
Is there anything we can say about s(N)?
Konigsberg 8:04:51 pm
we get the modulo 9, because taking digit sums preserves the remainder when the number is divided by 9
jeff10 8:04:51 pm
I am thinking mod 9
MathForFun 8:04:51 pm
mod 9
Cogswell 8:04:51 pm
it is congruent to N (mod 9)
Valentin Vornicu 8:04:54 pm
We know that s(N) is congruent to N modulo 9.
Valentin Vornicu 8:05:02 pm
We can we say that C is congruent to 4444^4444 modulo 9.
8/13/2019 10 - Modular Arithmetic
36/116
Valentin Vornicu 8:05:06 pm
How can we compute this residue?
alex31415 8:06:13 pm
4444=7 mod 9
aerrowfinn72 8:06:13 pm
take 4444 mod 9 first and then take 4444 mod phi(9)
loquidyE 8:06:13 pm
congruent to 7^4444
jeff10 8:06:13 pm
7^7 (mod 9)=7 (mod 9)
Valentin Vornicu 8:06:16 pm
Valentin Vornicu 8:06:19 pm
How can we simplify this?
Seedleaf 8:06:31 pm
eulers theorem
MathTwo 8:06:31 pm
euler?
filetmignon821 8:06:31 pm
4444^6=1 (mod 9)
filetmignon821 8:06:31 pm
by euler's theorem, this is just 4444^4 mod 9
fractals 8:06:34 pm
phi(9) = 6
Valentin Vornicu 8:06:52 pm
We can use Euler's Theorem.
Valentin Vornicu 8:06:57 pm
Valentin Vornicu 8:07:33 pm
Valentin Vornicu 8:07:43 pm
Valentin Vornicu 8:07:47 pm
Therefore, C is congruent to 7 modulo 9.
Valentin Vornicu 8:07:50 pm
How can we find the exact value of C?
Cogswell 8:08:48 pm
bounding
aerrowfinn72 8:08:48 pm
bound it
Valentin Vornicu 8:08:50 pm
Let's proceed by finding an upper bound on A, which is the sum of the digits of 4444^4444. What is an upper bound on A?
filetmignon821 8:09:44 pm
we know that s(n) is less than or equal to 9(log n+1), so we have that s(4444^4444) is at most 9(4444log4444+1)
Valentin Vornicu 8:09:49 pm
We can try to find the exact number of digits in 4444^4444, but that would involve using logarithms. What if we didn't have a
calculator? Can we find an estimate on A, even a crude one?
nikgran 8:10:39 pm
8/13/2019 10 - Modular Arithmetic
37/116
8/13/2019 10 - Modular Arithmetic
38/116
Valentin Vornicu 8:14:02 pm
We have shown that C is congruent to 7 modulo 9, so we conclude that C = 7.
Valentin Vornicu 8:14:48 pm
Valentin Vornicu 8:14:59 pm
What makes this sum difficult to deal with?
Cogswell 8:16:08 pm
absolute values
filetmignon821 8:16:08 pm
absolute value
alex31415 8:16:08 pm
Absolute value signs
matholympiad25 8:16:08 pm
The absolute values!
MathForFun 8:16:08 pm
absolute values
Konigsberg 8:16:08 pm
because it is absolute values
Valentin Vornicu 8:16:27 pm
The absolute value signs make this sum difficult to deal with. How can we deal with the absolute value signs? Is there a convenient
way of getting rid of them?
lightbluemathangel 8:17:39 pm
a_i > b_i for all i
antimonyarsenide 8:17:39 pm
WLOG let ai>bi
gurev 8:17:39 pm
We can switch the order of the pairs to make ai the bigger one, and the absolute values dissappear
Porteradams 8:17:39 pm
have ai always greater than or equal to bi
Valentin Vornicu 8:17:42 pm
Valentin Vornicu 8:18:01 pm
Valentin Vornicu 8:18:11 pmEach summand in this is 1 or 6. How can we use this information?
Valentin Vornicu 8:19:08 pm
There are 999 summands, so let k of them be equal to 1, so the remaining 999 - k are equal to 6.
Valentin Vornicu 8:19:19 pm
Valentin Vornicu 8:19:23 pm
Doink 8:20:46 pm
8/13/2019 10 - Modular Arithmetic
39/116
they are all in the range from 1 to 1998
jeff10 8:20:46 pm
They are all less than or equal to 1998
lightbluemathangel 8:20:46 pm
they're all from 1 to 1998
Seedleaf 8:20:46 pm
they are distinct and belong to the set 1,2,...1998
Valentin Vornicu 8:20:48 pm
Valentin Vornicu 8:21:24 pm
So can we turn this fact into a related sum?
jerrytang 8:22:12 pm
The sum is 1997001
giratina150 8:22:12 pm
sum of (a_i)+sum of (b_i)=1998(1999)/2
filetmignon821 8:22:12 pm
they sum to whatever the sum of 1 through 1998 is
krmathcounts 8:22:12 pm
a1+b1+a2+b2+.....+a999+b999 = 1998*1999/2
Valentin Vornicu 8:22:52 pm
Valentin Vornicu 8:22:54 pm
What can we do with these two equations?
Cogswell 8:23:08 pm
add 'em?
lightbluemathangel 8:23:08 pmadd them and then divide by 2 to get the sum of the a_i's
krmathcounts 8:23:08 pm
add
Valentin Vornicu 8:23:12 pm
Valentin Vornicu 8:23:18 pm
We know that the left-hand side is even. Therefore, 5k must be odd, which means k must be odd.
Valentin Vornicu 8:23:21 pm
Let k = 2n + 1 for some integer n.
Valentin Vornicu 8:23:25 pm
Now what?
numbertheorist17 8:24:15 pm
your done!
Cogswell 8:24:15 pm
sum=5994-5(2n+1)=5989-10n
nikgran 8:24:15 pm
we are done, the sum ends in 9
pi.guy3.14 8:24:15 pm
replace k with n
Valentin Vornicu 8:24:17 pm
8/13/2019 10 - Modular Arithmetic
40/116
We can substitute into the equation above, to get
Valentin Vornicu 8:24:21 pm
Valentin Vornicu 8:24:26 pm
It looks like we can conclude that this number always ends in 9, but what if n is sufficiently high so that 5989 - 10n is negative? For
example, if n = 600, then 5989 - 10n = -11, which ends in 1.
briantix 8:25:37 pm
all the terms are positive
ajb 8:25:37 pm
Absolute values ensure it is posit ive
apple.singer 8:25:37 pm
absolute values. can't be negative
gurev 8:25:37 pm
How can this be negative there's absolute values?
Valentin Vornicu 8:25:38 pm
The original sum was expressed as a sum of absolute values, which must be nonnegative. And a nonnegative number of the form
5989 - 10n must end in 9, so we are home free.
Valentin Vornicu 8:25:47 pm
Valentin Vornicu 8:25:53 pm
How can we proceed?
Cogswell 8:27:21 pm
assume the contrary
aerrowfinn72 8:27:21 pm
go for proof by contradiction
numbertheorist17 8:27:21 pm
contradiction
fractals 8:27:21 pm
assume that you can then find contradiction
Valentin Vornicu 8:27:22 pm
We can argue by contradiction.
Valentin Vornicu 8:27:44 pm
Note that 2 x 5 - 1 = 9, 2 x 13 - 1 = 25, and 5 x 13 - 1 = 64 are all perfect squares.
Valentin Vornicu 8:27:48 pm
Suppose 2d - 1 = x^2, 5d - 1 = y^2, and 13d - 1 = z^2, for some positive integers x, y, and z.
Valentin Vornicu 8:27:56 pm
What does the first equation 2d - 1 = x^2 tell us?
gurev 8:28:41 pmx is odd
jerrytang 8:28:41 pm
x is odd
lightbluemathangel 8:28:41 pm
x^2==1 (mod 2)
giratina150 8:28:41 pm
x is odd
pi.guy3.14 8:28:41 pm
x is odd
Valentin Vornicu 8:28:44 pm
8/13/2019 10 - Modular Arithmetic
41/116
8/13/2019 10 - Modular Arithmetic
42/116
Subtract for difference of squares.
ajb 8:31:18 pm
subtract them and use difference of squares
Valentin Vornicu 8:31:22 pm
We can factor the right-hand side, to get 2d = (v + u)(v - u).
Valentin Vornicu 8:31:27 pm
Can we say anything interesting about the factors v + u and v - u?
aerrowfinn72 8:31:43 pm
same parity
giratina150 8:31:43 pm
same parity
filetmignon821 8:31:43 pm
they have the same parity
fractals 8:31:43 pm
must be of same parity
Cogswell 8:31:43 pm
same parity-->d is even. But d is odd.
duketip10 8:31:43 pm
same parity
jerrytang 8:31:43 pmSame parity
Valentin Vornicu 8:31:46 pm
Either v + u and v - u are both even or both odd (since their difference 2u is an even number).
Valentin Vornicu 8:31:51 pm
If v + u and v - u are both even, then their product (v + u)(v - u) is a multiple of 4. If v + u and v - u are both odd, then their product
(v + u)(v - u) is odd. In particular, (v + u)(v - u) cannot be equal to 2d, because d is odd.
Valentin Vornicu 8:31:56 pm
We have obtained a contradiction, so at least one of 2d - 1, 5d - 1, and 13d - 1 is not a perfect square.
Valentin Vornicu 8:32:03 pm
It can seem simple, but using parity can be a powerful tool. And whenever you find that a number is even (odd resp.), it is usually a
good idea to write it in the form 2n (2n + 1 resp.).
Valentin Vornicu 8:38:45 pm
Valentin Vornicu 8:38:55 pm
Let f(n) = 19 x 8^n + 17. What approach can we take here?
Seedleaf 8:40:06 pm
look at small values of n first
fractals 8:40:06 pm
find some mod that works
filetmignon821 8:40:06 pm
prove it's divisible by something
ajb 8:40:06 pm
Modulo small numbers
Valentin Vornicu 8:40:10 pm
We can see if there exists a number d > 1 such that f(n) = 19 x 8^n + 17 is always divisible by d, by reducing it modulo d.
Valentin Vornicu 8:40:15 pm
What numbers d should we try?
pi.guy3.14 8:41:33 pm
9
BOBBOBBOB 8:41:33 pm
9
gurev 8:41:33 pm
8/13/2019 10 - Modular Arithmetic
43/116
9?
Valentin Vornicu 8:41:35 pm
We should try numbers d such that 8 n modulo d simplifies.
Valentin Vornicu 8:41:40 pm
The first obvious number to try is d = 8.
Valentin Vornicu 8:41:52 pm
Valentin Vornicu 8:42:10 pm
(9 is a good idea because 8 = - 1 (mod 9))
Valentin Vornicu 8:43:11 pm
So reducing modulo 7 doesn't get us anywhere either.
Valentin Vornicu 8:43:29 pm
Valentin Vornicu 8:43:48 pm
We can look at the first few values of f(n), and see which divisors come up.
Valentin Vornicu 8:43:58 pm
What is f(0) and its prime factorization?
fireonice 8:45:03 pm
36=2^2*3^2
MathForFun 8:45:03 pm
2^2 3^2
Porteradams 8:45:03 pm
2^2(3^2)
loquidyE 8:45:03 pm
36 = 2^2 * 3^2
nikgran 8:45:03 pm
2^2*3^2
Seedleaf 8:45:03 pm
36
Valentin Vornicu 8:45:04 pm
f(0) = 36 = 2^2 x 3^2.
Valentin Vornicu 8:45:08 pm
What is f(1) and its prime factorization?
jerrytang 8:46:28 pm
13^2; 169
fireonice 8:46:28 pm
169= 13^2
msinghal 8:46:28 pm
169=13^2
duketip10 8:46:28 pm
169=13^2
yjhan96 8:46:28 pm
169=13^2
Valentin Vornicu 8:46:29 pm
f(1) = 169 = 13^2.
Valentin Vornicu 8:46:38 pm
What is f(2) and its prime factorization?
filetmignon821 8:47:15 pm
1233=3^2*137
Seedleaf 8:47:15 pm
8/13/2019 10 - Modular Arithmetic
44/116
1233, 9*137
giratina150 8:47:15 pm
3^2*137
Valentin Vornicu 8:47:16 pm
f(2) = 1233 = 3^2 x 137.
Valentin Vornicu 8:47:20 pm
What is f(3) and its prime factorization?
filetmignon821 8:48:00 pm
9745=5*1949
giratina150 8:48:00 pm
5*1949
Valentin Vornicu 8:48:01 pm
f(3) = 9745 = 5 x 1949.
Valentin Vornicu 8:48:32 pm
Do we see anything promising?
msinghal 8:49:55 pm
for even n, 9 is a factor. for n=1 mod 4, 13 is a factor
ajb 8:49:55 pm
Okay, so it doesn't seem there is an n which divides all f(x), but 3^2=9 divides every even one
gurev 8:49:55 pmIf n is even, this is divisible by 3, which is apparent when the expression is taken mod 9.
fractals 8:49:55 pm
if n even divisible by 9
dinoboy 8:49:55 pm
every f(n) is divisible by a "small prime"
Valentin Vornicu 8:49:58 pm
We see that 3 divides both f(0) and f(2), so let's work modulo 3 and see what happens.
Valentin Vornicu 8:50:06 pm
Valentin Vornicu 8:50:07 pm
When is 2^n + 2 divisible by 3?
briantix 8:50:38 pm
when n is even
fractals 8:50:38 pm
n even
Doink 8:50:38 pm
when n is even
Seedleaf 8:50:38 pm
when n is even
Valentin Vornicu 8:50:45 pm
Since 2 is congruent to -1 modulo 3, 2^n + 2 is divisible by 3 if and only if n is even, which means f(n) is divisible by 3 if and only if n
is even.
Valentin Vornicu 8:50:54 pm
Now we must look at f(n) for odd n. Let n = 2t + 1. What modulus can we work with?
gurev 8:51:31 pm
5
Konigsberg 8:51:31 pm
5?
Cogswell 8:51:33 pm
5
Valentin Vornicu 8:51:34 pm
8/13/2019 10 - Modular Arithmetic
45/116
Since 5 is a factor of f(3), let's work modulo 5.
Valentin Vornicu 8:51:43 pm
Valentin Vornicu 8:51:53 pm
When is 4^t + 1 divisible by 5?
briantix 8:52:25 pm
when t is odd
lightbluemathangel 8:52:25 pm
t is odd
yjhan96 8:52:25 pm
when t is odd
Konigsberg 8:52:25 pm
when t is an odd number
fireonice 8:52:25 pm
when t is odd
Valentin Vornicu 8:52:28 pm
Since 4 is congruent to -1 modulo 5, 4^t + 1 is divisible by 5 if and only if t is odd.
Valentin Vornicu 8:52:41 pm
Now we must look at f(2t + 1) for t even. Let t = 2u. Then f(2t + 1) = f(4u + 1).
Valentin Vornicu 8:52:44 pm
What modulus can we work with?
Seedleaf 8:52:59 pm
13
yjhan96 8:52:59 pm
13
gurev 8:52:59 pm
13
Cogswell 8:52:59 pm
13?
fireonice 8:52:59 pm
13
Valentin Vornicu 8:53:01 pm
There's really only one choice. Since f(1) = 13 2, let's work modulo 13.
Valentin Vornicu 8:53:09 pm
Valentin Vornicu 8:53:28 pm
Thus, f(4u + 1) is always divisible by 13.
Valentin Vornicu 8:53:33 pm
To summarize, if n is even, then f(n) is divisible by 3 (and f(n) > 3),
Valentin Vornicu 8:53:38 pm
8/13/2019 10 - Modular Arithmetic
46/116
if n is of the form 4k + 3, then f(n) is divisible by 5 (and f(n) > 5),
Valentin Vornicu 8:53:43 pm
and if n is of the form 4k + 1, then f(n) is divisible by 13 (and f(n) > 13).
Valentin Vornicu 8:53:49 pm
Therefore, f(n) is composite for all nonnegative integers n.
Valentin Vornicu 8:54:06 pm
This problem shows that sometime you must try different moduli, even within the same problem, so don't be afraid to experiment.
Valentin Vornicu 8:54:25 pm
Valentin Vornicu 8:54:34 pm
You may recall Euclid's proof that there are an infinite number of primes. How can we start?
briantix 8:54:54 pm
hmmm...contradiction?
MathForFun 8:54:54 pm
contradiction
fireonice 8:54:54 pm
assume there are a finite number of primes
Porteradams 8:54:54 pm
assume the contradiction
jerrytang 8:54:54 pm
Contradiction
Valentin Vornicu 8:54:55 pm
We argue by contradiction.
Valentin Vornicu 8:55:01 pm
Valentin Vornicu 8:55:07 pm
Then what?
Seedleaf 8:56:22 pm
multiply them together
Porteradams 8:56:22 pm
multiply all p together
giratina150 8:56:22 pm
multiply together
pi.guy3.14 8:56:22 pm
product+!
MathForFun 8:56:22 pm
multiply them all!
Valentin Vornicu 8:56:26 pm
Valentin Vornicu 8:57:11 pm
What can we say about P?
fractals 8:57:37 pm
it is 2 mod 3 if k is even
Seedleaf 8:57:37 pm
either P = 0 or 2 mod 3
Valentin Vornicu 8:57:40 pm
8/13/2019 10 - Modular Arithmetic
47/116
Valentin Vornicu 8:58:28 pm
Suppose P reduces to 2 modulo 3. Then what can we say about P?
Konigsberg 8:59:28 pm
then it is in the form of 3n+2
Porteradams 8:59:28 pm
it is of the form 3n+2 which was not on the list
giratina150 8:59:28 pm
it's of the form 3n+2
jerrytang 8:59:28 pm
It is of form 3n+2, new prime, contradiction
briantix 8:59:28 pm
it must have a prime factor that is 2 mod three
Valentin Vornicu 8:59:30 pm
All primes (other than 3) are congruent to 1 modulo 3 and 2 modulo 3. If P was only divisible by primes congruent to 1 modulo 3,
then P itself would be congruent to 1 modulo 3. But P is congruent to 2 modulo 3, so P must be divisible by at least one prime that is
congruent to 2 modulo 3.
Valentin Vornicu 8:59:36 pm
But by construction, P is relatively prime to all primes that are congruent to 2 modulo 3, contradiction.
Valentin Vornicu 8:59:55 pm
The only case that is left is if P reduces to 0 modulo 3. Unfortunately, there's no good way to handle this case. (We can divide out al
the factors of 3, but there's nothing we can say about the resulting quotient.)
Valentin Vornicu 8:59:58 pm
Is there any way to fix this argument?
filetmignon821 9:01:26 pm
consider 3p_1p_2...p_k - 1. This must be divisible by some prime of the form 3n+2, but is not divisible by any of the p_i. this forces a
contradiction.
dinoboy 9:01:26 pm
take P = 3p_1p_2...p_k + 2, then its forced to be 2 mod 3
Valentin Vornicu 9:01:36 pm
Valentin Vornicu 9:01:38 pmThen P always reduces to 2 modulo 3, and we can proceed as above.
Valentin Vornicu 9:01:44 pm
More generally, if a and b are relatively prime positive integers, then there are infinitely many primes of the form an + b. This result
is known as Dirichlet Theorem, but it is an advanced result and is difficult to prove.
Valentin Vornicu 9:01:49 pm
The ideas in Euclid's proof lead to the next few problems.
Valentin Vornicu 9:01:58 pm
Valentin Vornicu 9:03:08 pm
To get a feel for the problem, let's find the first few terms of the sequence.
Valentin Vornicu 9:03:14 pm
What is p_2?
BOBBOBBOB 9:03:22 pm
3
lightbluemathangel 9:03:22 pm
3
matholympiad25 9:03:22 pm
3
filetmignon821 9:03:22 pm
3
8/13/2019 10 - Modular Arithmetic
48/116
gurev 9:03:22 pm
3
aerrowfinn72 9:03:22 pm
3
Valentin Vornicu 9:03:23 pm
p_2 is the largest prime divisor of p_1 + 1 = 3, so p_2 = 3.
Valentin Vornicu 9:03:25 pm
What is p_3?
giratina150 9:03:33 pm
7
filetmignon821 9:03:33 pm
7
aerrowfinn72 9:03:33 pm
7
loquidyE 9:03:33 pm
7
fireonice 9:03:33 pm
7
Seedleaf 9:03:33 pm
7
Valentin Vornicu 9:03:33 pm
p_3 is the largest prime divisor of p_1 p_2 + 1 = 7, so p_3 = 7.
Valentin Vornicu 9:03:36 pm
What is p_4?'
BOBBOBBOB 9:03:42 pm
43
aerrowfinn72 9:03:42 pm
43
matholympiad25 9:03:42 pm
43
ajb 9:03:42 pm43
giratina150 9:03:42 pm
43
fireonice 9:03:42 pm
43
Cogswell 9:03:42 pm
43
Valentin Vornicu 9:03:43 pm
p_4 is the largest prime divisor of p_1 p_2 p_3 + 1 = 43, so p_4 = 43.
Valentin Vornicu 9:03:45 pm
What is p_5?
giratina150 9:04:34 pm
139?
Cogswell 9:04:34 pm
139
Valentin Vornicu 9:04:35 pm
p_5 is the largest prime divisor of p_1 p_2 p_3 p_4 + 1 = 1807 = 13 x 139, so p_4 = 139.
Valentin Vornicu 9:04:42 pm
We must show that 5 never appears in the sequence.
Valentin Vornicu 9:04:44 pm
How can we proceed?
8/13/2019 10 - Modular Arithmetic
49/116
saphireflame 9:05:58 pm
proof by contradiction
krmathcounts 9:05:58 pm
assume 5 does show up?
Valentin Vornicu 9:06:01 pm
We can argue by contradiction.
Valentin Vornicu 9:06:11 pm
Valentin Vornicu 9:06:41 pm
What does that say about this expression?
Cogswell 9:06:57 pm
p_1p_2/dotsp_n-1+1 = 2^Q3^R5^S
MathTwo 9:06:57 pm
some multiplication of 2s, 3 and 5
briantix 9:06:57 pm
so its 2^a*3^b*5^c
jerrytang 9:06:57 pm
Only primes are 2, 3, 5
Valentin Vornicu 9:06:59 pm
Valentin Vornicu 9:07:02 pm
Can we say more?
filetmignon821 9:08:25 pm
this can't be a multiple of 2 or 3, since p_1 and p_2 are 2 and 3, so it must be a power of 5.
Seedleaf 9:08:25 pm
its only a power of 5
fireonice 9:08:25 pm
5 only because 2 and 3 show up in the sequence
apple.singer 9:08:32 pm
just 5, as 2 and 3 are p_1 and p_2 and thus will not divide the product +1
Valentin Vornicu 9:08:35 pm
Valentin Vornicu 9:08:45 pm
Valentin Vornicu 9:09:01 pm
Valentin Vornicu 9:09:10 pm
Valentin Vornicu 9:09:12 pm
What can we do with this equation?
8/13/2019 10 - Modular Arithmetic
50/116
fractals 9:10:18 pm
mod 4
briantix 9:10:18 pm
factor it
lightbluemathangel 9:10:18 pm
factor out (5-1)
giratina150 9:10:18 pm
mod 4
ajb 9:10:18 pm
5^k-1=0 mod 4
briantix 9:10:18 pm
both sides must have a 2^2 in them but that's impossible for the left one
filetmignon821 9:10:18 pm
difference of kth powers forces p_1p_2...p_{n-1} to be divisible by 4
aerrowfinn72 9:10:18 pm
take it mod 4
Valentin Vornicu 9:10:24 pm
Valentin Vornicu 9:10:27 pm
This equation tells us that 4 must be a factor of the left-hand side.
Valentin Vornicu 9:10:34 pm
But this is impossible because p_1 = 2 and all further terms p_2, ..., p_{n - 1} are odd.
Valentin Vornicu 9:10:37 pm
We have a contradiction, so 5 cannot be a member of this sequence.
Valentin Vornicu 9:10:49 pm
I'll let you think about why 11 is also not in the sequence.
Valentin Vornicu 9:10:55 pm
Valentin Vornicu 9:11:27 pm
I actually proposed this problem for the IMO TST. Only the 6 students that actually made the team managed to solve it.
Valentin Vornicu 9:11:48 pm
Let's start by looking at small primes. Is the prime 2 in P?
filetmignon821 9:12:30 pm
i bet it is, since P is the set of all primes
msinghal 9:12:30 pm
yes, all primes are in P
Cogswell 9:12:30 pm
yes, since it 's prime
Valentin Vornicu 9:12:36 pm
That's not exactly a proof
gurev 9:13:13 pm
Did you mean is it in M, which is also true?
Valentin Vornicu 9:13:30 pm
Oops, a small typo. We're looking at 2 being in M.
Cogswell 9:14:06 pm
let A be the set of all odd primes in M. The result follows.
8/13/2019 10 - Modular Arithmetic
51/116
dinoboy 9:14:06 pm
suppose not, take an odd prime in M and let it be A. Then we reach a contradiction so 2 is in M
Valentin Vornicu 9:14:08 pm
Since M contains at least three primes, there is an odd prime in M, say p. Let A = {p}. Then by the condition in the problem, all the
prime factors of p - 1 are also in M.
Valentin Vornicu 9:14:39 pm
But p - 1 is even, so 2 is in M.
Valentin Vornicu 9:14:48 pm
Is the prime 3 in M?
gurev 9:15:40 pm
Yes
Cogswell 9:15:40 pm
yes
Valentin Vornicu 9:15:47 pm
I need a justification to give you all the 7 points.
filetmignon821 9:17:09 pm
if we have another prime p in M that is 1 mod 3, then 3 is in M. If p is 2 mod 3, then 2p is 1 mod 3, so 2p-1 is divisible by three. thus, 3 is in M
ajb 9:17:09 pm
there must be at least two elements equal to 1 mod 3 or 2 mod 3 by pigeonhole
Cogswell 9:17:09 pm
take the two primes in M that are not 3. If one is 1 mod 3, the result follows. If they both are 2 mod 3, their product is 1 mod 3, and the resultfollows
Valentin Vornicu 9:17:22 pm
If M contains a prime of the form p = 3n + 1, then take A = {p}. Then all the factors of p - 1 = 3n are also in M, so 3 is in M.
Valentin Vornicu 9:17:28 pm
Otherwise, M contains two primes of the form 3n + 2, say p and q, and we can take A = {p, q}. Then all the prime factors of pq - 1
are also in M.
Valentin Vornicu 9:17:31 pm
But pq - 1 is congruent to 2 x 2 - 1 = 3, or 0 modulo 3, so pq - 1 is divisible by 3. Therefore, 3 is in M. In either case, 3 is in M.
Valentin Vornicu 9:17:35 pm
Is the prime 5 in M?
filetmignon821 9:19:05 pmyeah. 2*3-1=5
ajb 9:19:05 pm
yes, since 2*3=6, and 6-1=5
loquidyE 9:19:05 pm
yes; 2*3 - 1 = 5
msinghal 9:19:05 pm
yes, 2*3 - 1
Valentin Vornicu 9:19:06 pm
We know 2 and 3 are in M, so take A = {2, 3}. Then 2 x 3 - 1 = 5, so 5 is in M.
Valentin Vornicu 9:19:11 pm
Is the prime 7 in M?
briantix 9:20:00 pm
3*5-1=2*7 so yes
apple.singer 9:20:00 pm
yes, take {3,5}
antimonyarsenide 9:20:00 pm
yes, 7 | 3*5 - 1
gurev 9:20:00 pm
Yeah, 3*5-1
Seedleaf 9:20:00 pm
3*5 - 1 = 2*7
8/13/2019 10 - Modular Arithmetic
52/116
Cogswell 9:20:00 pm
yes (a={3,5})
filetmignon821 9:20:00 pm
yeah, 3*5-1=14, which is divisible by 7
Valentin Vornicu 9:20:01 pm
We know 3 and 5 are in M, so take A = {3, 5}. Then 3 x 5 - 1 = 14 = 2 x 7, so 7 is in M.
Valentin Vornicu 9:20:20 pm
Hence, the first few primes are in M. We want to prove that M contains all primes.
Valentin Vornicu 9:20:25 pm
What intermediate result can we try proving first?
gurev 9:20:43 pm
infinitely many
antimonyarsenide 9:20:43 pm
M contains infinitely many primes
Valentin Vornicu 9:20:45 pm
Let's try proving first that M is infinite.
Valentin Vornicu 9:20:50 pm
Valentin Vornicu 9:21:06 pm
As a start, let's take A to be all the primes in M, except one, say p_i. (Remember that A must be a proper subset of M.)
Valentin Vornicu 9:21:11 pm
Valentin Vornicu 9:21:19 pm
Cogswell 9:22:29 pm
the only prime that can divide it is p_i
NewAlbionAcademy 9:22:29 pm
It isn't divisible by any of them, so it must be a power of p_i
gurev 9:22:29 pm
it's a power of pi
Valentin Vornicu 9:22:47 pm
Valentin Vornicu 9:23:02 pm
Valentin Vornicu 9:23:17 pm
8/13/2019 10 - Modular Arithmetic
53/116
Valentin Vornicu 9:23:31 pm
To make these equations simpler to work with, we start by omitting the smallest primes.
Valentin Vornicu 9:23:38 pm
Valentin Vornicu 9:25:06 pm
Valentin Vornicu 9:25:37 pm
Valentin Vornicu 9:25:41 pm
Valentin Vornicu 9:26:15 pm
What can we do with these two expressions for P?
giratina150 9:26:33 pm
equate
Cogswell 9:26:33 pm
set them equal to each other
Porteradams 9:26:33 pm
set them equal
fireonice 9:26:33 pm
set them equal to each other
Valentin Vornicu 9:26:35 pm
We can equate them.
Valentin Vornicu 9:26:45 pm
Valentin Vornicu 9:26:54 pm
Let's start analyzing this equation.
Valentin Vornicu 9:27:02 pm
8/13/2019 10 - Modular Arithmetic
54/116
Valentin Vornicu 9:27:04 pm
Also, P is at least 2 x 3 x 5 x 7. So what can we say about a?
Cogswell 9:28:06 pm
a is at least 6
Porteradams 9:28:06 pm
at least 6
pi.guy3.14 9:28:06 pm
at least 6
Valentin Vornicu 9:28:08 pm
Valentin Vornicu 9:28:19 pm
Valentin Vornicu 9:28:23 pm
So what can we say about b?
Cogswell 9:28:50 pm
it is at least 1.
Valentin Vornicu 9:28:52 pm
Valentin Vornicu 9:28:59 pm
Valentin Vornicu 9:29:14 pm
matholympiad25 9:29:43 pm
it is odd.
fractals 9:29:43 pm
odd
MathForFun 9:29:43 pm
It's odd
giratina150 9:29:43 pm
odd
jerrytang 9:29:43 pm
It is odd.
fireonice 9:29:43 pm
it is odd
Valentin Vornicu 9:29:46 pm
Valentin Vornicu 9:29:51 pm
gurev 9:29:55 pm
b is 1
MathForFun 9:29:55 pm
so b=1
Valentin Vornicu 9:29:56 pm
Therefore, b = 1.
Valentin Vornicu 9:30:01 pm
8/13/2019 10 - Modular Arithmetic
55/116
8/13/2019 10 - Modular Arithmetic
56/116
8/13/2019 10 - Modular Arithmetic
57/116
8/13/2019 10 - Modular Arithmetic
58/116
Art of Problem Solving
WOOT
Copyright AoPS Incorporated. This page is copyrighted material. You can view and print this page for your own use, but you
cannot share the contents of this file with others.
Class Transcript 01/24 - Modular Arithmetic B
Valentin Vornicu 9:00:37 pm
WOOT 2012-13: Modular Arithmetic B
Valentin Vornicu 9:00:44 pm
In today's lecture, we will continue our look at number theory and modular arithmetic. The first half of our class will focus on the use
of Fermat's Little Theorem and Euler's Theorem. In the second half, we'll cover some more general number theory problems that
are typical for this level.
Valentin Vornicu 9:00:49 pm
We'll start with a nice warm-up exercise.
Valentin Vornicu 9:00:55 pm
Valentin Vornicu 9:01:22 pm
How can we find the missing digit?
KingSmasher3 9:01:37 pmmod 9!
vishankjs 9:01:37 pm
look mod 9
v_Enhance 9:01:37 pm
Take mod 9
Valentin Vornicu 9:01:45 pm
We can try to find the sum of the 9 digits. If all 10 digits were present, then their sum would be 0 + 1 + 2 + .. . + 9 = 45. However, we
can't find the sum of the 9 digits without computing 2 29.
Valentin Vornicu 9:01:52 pm
We know that a number and the sum of its digits are congruent modulo 9, so we can reduce 2^29 modulo 9. What do we get?
Mousie 9:04:57 pm5mod9
greensteg2 9:04:57 pm
5 mod 9
Bryan.C 9:04:57 pm
5
aopsqwerty 9:04:57 pm
5
woodstock 9:04:57 pm
5
AkshajK 9:04:57 pm
zhaoamc 9:04:57 pm
5 mod 9
AkshajK 9:04:57 pm
mentalgenius 9:04:57 pm
5
Valentin Vornicu 9:05:01 pm
Valentin Vornicu 9:05:43 pm
8/13/2019 10 - Modular Arithmetic
59/116
So what is the missing digit?
baijiangchen 9:06:02 pm
4
ABCDE 9:06:02 pm
so the digit is 4
vishankjs 9:06:02 pm
4
Mousie 9:06:02 pm
4?
zhaoamc 9:06:02 pm
4
woodstock 9:06:02 pm
4
sdaops 9:06:02 pm
4
cire_il 9:06:02 pm
4
Valentin Vornicu 9:06:03 pm
The missing digit must be congruent to -5 modulo 9, so the missing digit is 4.
Valentin Vornicu 9:06:06 pmIndeed, 2^29 = 536870912. All digits are present except 4.
Valentin Vornicu 9:06:13 pm
Valentin Vornicu 9:06:19 pm
How do we start?
algebra1337 9:07:42 pm
mod 1000
KingSmasher3 9:07:42 pm
last three digits means mod 1000
hawqish 9:07:42 pm
take mod 1000
maxmk 9:07:42 pm
mod 1000
aopsqwerty 9:07:42 pm
mod 1000
Valentin Vornicu 9:07:42 pm
Finding the last three digits of a number is an indication to work modulo 1000.
Valentin Vornicu 9:07:48 pm
Valentin Vornicu 9:07:51 pm
How can we reduce this?
zhaoamc 9:08:00 pm
eulor's totient thm
sdaops 9:08:00 pm
We want mod 1000, so phi(1000) is useful
Porteradams 9:08:00 pm
eulers theorem
Valentin Vornicu 9:08:02 pm
We can use Euler's Theorem.
Valentin Vornicu 9:08:05 pm
8/13/2019 10 - Modular Arithmetic
60/116
Valentin Vornicu 9:08:47 pm
Valentin Vornicu 9:08:52 pm
Probably the easiest way to compute this is to look at the first few powers of 8 modulo 400. We do this by starting with 1, then
multiplying each term by 8 and reducing modulo 400.
Valentin Vornicu 9:08:56 pm
This gives us 1, 8, 64, 112, 96, 368, 144, 352.
Valentin Vornicu 9:09:04 pm
Valentin Vornicu 9:09:11 pm
We have gone as far as we can with Euler's Theorem. We can try to compute this by looking at the first few powers of 9 modulo
1000, but there is an easier way.
Valentin Vornicu 9:09:15 pm
Is there anything you notice about the number 9 that may make it easier to compute this power modulo 1000?
sdaops 9:09:44 pm
It's 10-1
greensteg2 9:09:44 pm
9 = 10 - 1
ksun48 9:09:44 pm
oh... It's 10-1
Mousie 9:09:44 pm
10 - 1
baijiangchen 9:09:44 pm
9 = (10-1)
GeorgiaTechMan 9:09:44 pm
and its congruent to -1 mod 10!
KingSmasher3 9:09:44 pm
teethpaste 9:09:44 pm
9=10-1?
Valentin Vornicu 9:09:50 pm
Valentin Vornicu 9:10:58 pm
Valentin Vornicu 9:11:03 pm
Therefore, the last three digits of 9^(8 7) are 081.
Valentin Vornicu 9:11:11 pm
Valentin Vornicu 9:11:19 pm
We could verify that n^5 - n is divisible by 30 for n = 0, 1, 2, ..., 29. But what is an easier way?
maxmk 9:12:40 pm
2, 3, 5
AkshajK 9:12:40 pm
SkinnySanta 9:12:40 pm
fermats little theorem for 2,3,5 and apply c rt
8/13/2019 10 - Modular Arithmetic
61/116
8/13/2019 10 - Modular Arithmetic
62/116
Yes. By reducing modulo 5, we can check for n = 0, 1, 2, 3, and 4. We can also simply cite Fermat's Little Theorem for the prime p =
5.
Valentin Vornicu 9:14:42 pm
Hence, n^5 - n is divisible by 2 x 3 x 5 = 30 for all integers n.
Valentin Vornicu 9:14:46 pm
This simple problem illustrates an important principle. If you want to prove that a number is divisible by n, it helps to look at the
individual prime powers of n.
Valentin Vornicu 9:15:46 pm
Valentin Vornicu 9:15:54 pm
We start by trying to reduce the given expression modulo 2000, but all the bases are already less than 2000. So what else can we
do?
algebra1337 9:17:22 pm
mod 16 and mod 125
anwang16 9:17:22 pm
mod 16? mod 25?
aopsqwerty 9:17:22 pm
show it is divisible by 16 and 125
baijiangchen 9:17:22 pm
factor into 2^4 5^3
KingSmasher3 9:17:22 pm
prove divisibility by 125 and 16
GeorgiaTechMan 9:17:22 pm
try mod 16 and mod 125
Valentin Vornicu 9:17:24 pm
The prime factorization of 2000 is 2 4 x 5^3, so we look at the factors 2 4 = 16 and 5^3 = 125 separately.
Valentin Vornicu 9:17:28 pm
How does the given expression reduce modulo 16?
GeorgiaTechMan 9:18:53 pm
9^n-9^n+(-4)^n - (-4)^n
greensteg2 9:18:53 pm
9^n - 9^n + 12^n - (-4)^n
teethpaste 9:18:53 pm
12^n - (-4)^n
DVA6102 9:18:53 pm
9^n-9^n+12^n-12^n=0. yes
Mousie 9:18:53 pm
12^n - (-4)^n
Valentin Vornicu 9:18:54 pm
Valentin Vornicu 9:18:57 pm
Therefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 16.
Valentin Vornicu 9:19:06 pm
How does the given expression reduce modulo 125?
anwang16 9:20:12 pm
(121)^n-(25)^n+25^n-121^n
sdaops 9:20:12 pm
8/13/2019 10 - Modular Arithmetic
63/116
(-4)^n -25^n + 25^n - (-4)^n = 0
Mousie 9:20:12 pm
0 as well...terms cancel
woodstock 9:20:12 pm
121^n - 25^n + 25^n - 121^n
Valentin Vornicu 9:20:15 pm
Valentin Vornicu 9:20:17 pm
Therefore, 121^n - 25^n + 1900 n - (-4) n is divisible by 125.
Valentin Vornicu 9:20:21 pm
We conclude that 121 n - 25^n + 1900 n - (-4)^n is divisible by 2000 for all positive integers n.
Valentin Vornicu 9:20:31 pm
Valentin Vornicu 9:20:42 pm
What can we do with this equation?
anwang16 9:22:11 pm
mod something?
Valentin Vornicu 9:22:18 pm
What mod should we use?
GeorgiaTechMan 9:22:31 pm
actually, just 2, 3, and 5 suffice
SkinnySanta 9:22:31 pm
look modulo 30 since n^5 = n mof 30
Valentin Vornicu 9:22:37 pm
We can use a previous problem and reduce it modulo 30. This gives us
Valentin Vornicu 9:22:40 pm
Valentin Vornicu 9:22:45 pm
Now we need to find bounds on n to find its exact value. What's one obvious lower bound on n?
hawqish 9:24:28 pm
> 133?
ABCDE 9:24:28 pm
133
Mousie 9:24:28 pm
oops 133
greensteg2 9:24:28 pm
133
mentalgenius 9:24:28 pm
133
SkinnySanta 9:24:28 pm
133
8/13/2019 10 - Modular Arithmetic
64/116
woodstock 9:24:28 pm
133
GeorgiaTechMan 9:24:28 pm
n>133
Valentin Vornicu 9:24:29 pm
Clearly n > 133.
Valentin Vornicu 9:24:32 pm
Now we need to find an upper bound on n.
Valentin Vornicu 9:24:37 pm
The largest term in the left-hand side is 133^5, so we compare all the other terms to 133^5.
Valentin Vornicu 9:25:21 pm
We know that 110^5 < 133^5.
Valentin Vornicu 9:25:26 pm
Can we compare 84^5 + 27 5 and 133^5?
woodstock 9:26:41 pm
84^5 + 27^5 < 111^5 < 133^5
Mousie 9:26:41 pm
since 84^5 + 27^5 < 133^5
AkshajK 9:26:41 pm
(a+b)^5 > a^5 + b^5
DVA6102 9:26:41 pm
84^5+27^5 < 133^5
Valentin Vornicu 9:26:42 pm
Note that 84^5 + 27^5 < (84 + 27)^5 = 111^5 < 133^5.
Valentin Vornicu 9:26:48 pm
Valentin Vornicu 9:26:52 pm
What we would like to do now is take the fifth root of both sides. The problem is we would get the fifth root of 3, and it's not clear
what to do with this number.
Valentin Vornicu 9:26:56 pmSo let's see if we can replace 3 by the ratio of two fifth powers.
Valentin Vornicu 9:27:02 pm
The first few fifth powers are 1 5 = 1, 2^5 = 32, 3^5 = 243, 4 5 = 1024, 5^5 = 3125, and 6^5 = 7776, and so on. Do we see any fifth
powers that approximately have a ratio of 3?
ABCDE 9:28:42 pm
5^5 and 4^5
aopsqwerty 9:28:42 pm
4^5 and 5^5
jhfrost314 9:28:42 pm
5^5/4^5
greensteg2 9:28:42 pm
4^5 and 5^5
pi314159265358979 9:28:42 pm
5^5 and 4^5
hawqish 9:28:42 pm
5^4 and 4^5
baijiangchen 9:28:42 pm
(5/4)
GeorgiaTechMan 9:28:42 pm
4 and 5
sdaops 9:28:42 pm
Thus n < 133*5/4
8/13/2019 10 - Modular Arithmetic
65/116
zhaoamc 9:28:42 pm
5^5/4^5
Valentin Vornicu 9:28:43 pm
We see that 5^5/4 5 = 3125/1024 is approximately 3.
Valentin Vornicu 9:28:49 pm
Even better, this ratio is slightly larger than 3, which means we can use this ratio to get an upper bound on n:
Valentin Vornicu 9:28:52 pm
Valentin Vornicu 9:28:55 pm
Therefore, n < 5/4 x 133 = 166 + 1/4.
Valentin Vornicu 9:28:58 pm
So what is n?
Minamoto 9:29:08 pm
144
AkshajK 9:29:08 pm
144
KingSmasher3 9:29:08 pm
144
bobcat1209:29:08 pm
144
DVA6102 9:29:08 pm
144
Valentin Vornicu 9:29:10 pm
The only n satisfying 133 < n < 166 + 1/4, and n congruent to 24 modulo 30 is n = 144.
Valentin Vornicu 9:30:25 pm
Valentin Vornicu 9:30:33 pm
To make things easier, let s(N) denote the sum of the digits of N for a positive integer N. Then A = s(4444^4444) and B = s(A). Let C
= s(B). Then we want to find C.
Valentin Vornicu 9:31:43 pm
Is there anything we can say about s(N)?
DVA6102 9:33:15 pm
Can we take it mod 9, since s(x)==x mod 9?
sdaops 9:33:15 pm
Congruent to N mod 9
maxmk 9:33:15 pm
s(N) == N (mod 9)
ksun48 9:33:15 pm
9|N-s(N)
ABCDE 9:33:15 pm
s(N)==N mod 9
SkinnySanta 9:33:15 pm
s(n) = n mod 9
Valentin Vornicu 9:33:15 pm
We know that s(N) is congruent to N modulo 9.
Valentin Vornicu 9:33:26 pm
So we can we say that C is congruent to 4444^4444 modulo 9.
Valentin Vornicu 9:33:30 pm
How can we compute this residue?
woodstock 9:35:06 pm
8/13/2019 10 - Modular Arithmetic
66/116
4444 = 7 (mod 9)
Bryan.C 9:35:06 pm
euler's theorem
hawqish 9:35:06 pm
use euler's theorem
anwang16 9:35:06 pm
Get rid of most of the numbers and end up with 7^4444 which is -2^4444
AkshajK 9:35:06 pm
Valentin Vornicu 9:35:10 pm
Valentin Vornicu 9:35:18 pm
We can use Euler's Theorem to simplify this.
Valentin Vornicu 9:35:22 pm
Valentin Vornicu 9:36:11 pm
Valentin Vornicu 9:36:16 pm
Valentin Vornicu 9:36:21 pm
Therefore, C is congruent to 7 modulo 9.
aopsqwerty 9:36:25 pm
but 7=-2 (mod 9)
Valentin Vornicu 9:36:40 pm
True we could have used that, and it would have probably been a little faster. Same idea though!
Valentin Vornicu 9:36:47 pm
Now, how can we find the exact value of C?
Minamoto 9:38:16 pm
use bounds
aopsqwerty 9:38:16 pm
find bounds?
SkinnySanta 9:38:16 pm
find upper bounds based on the number of digits
sdaops 9:38:16 pm
Let's figure out roughly how big C is; if it's a single digit, we know it already.
V