What is the remainder of divided by 2017?
Note: You should try solving it without using calculator. It's easy to write a program to solve this, but imagine you have this in some math contest where you don't have access to calculator or computer.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Relevant wiki: Wilson's Theorem
By Wilson's theorem, since 2017 is prime, 2 0 1 6 ! ≡ − 1 ( m o d 2 0 1 7 ) . If we let 2 0 0 9 ! = x , then 2 0 1 6 ! = x ⋅ ( 2 0 1 0 ⋅ … ⋅ 2 0 1 6 ) , so we just need to find 2 0 1 0 ⋅ … ⋅ 2 0 1 6 ( m o d 2 0 1 7 ) .
This is not very difficult. We have 2 0 1 0 ⋅ … ⋅ 2 0 1 6 ≡ ( − 7 ) ⋅ … ⋅ ( − 1 ) ≡ − 5 0 4 0 ( m o d 2 0 1 7 ) . Thus − 1 ≡ − 5 0 4 0 x ( m o d 2 0 1 7 ) .
Now, you might observe that 5040 is roughly 5/2 times 2017. In fact, 5 0 4 0 ⋅ 2 = 1 0 0 8 0 = 2 0 1 7 ⋅ 5 − 5 . Thus, multiplying both sides by 2 gives − 2 ≡ − 1 0 0 8 0 x ≡ 5 x ( m o d 2 0 1 7 ) .
Finally, finding the inverse of 5 mod 2017 isn't too difficult; you only need to check 4 candidates. (The candidates are the first multiple of 5 after some multiple of 2017; namely, 2020 (after 2017), 4035 (after 4034), 6055 (after 6051), and 8070 (after 8068).) We see that 5 ⋅ 8 0 7 = 4 0 3 5 = 2 0 1 7 ⋅ 2 + 1 , so the inverse is 807. Thus we obtain x ≡ − 2 ⋅ 8 0 7 ≡ − 1 6 1 4 ≡ 4 0 3 ( m o d 2 0 1 7 ) .