All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Factorial Remainder (Posted on 2011-09-02)
Determine the remainder when 98! is divided by 101

*** For an extra challenge, solve this problem without using a computer program.

 See The Solution Submitted by K Sengupta Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Avoiding 98 mods (solution) | Comment 4 of 9 |
(n-2)! = 1 (mod n) if n is prime.  (Look up Wilson's Theorem for proofs).

This is because every number between 2 and n-2 has a unique multiplicative inverse different than itself between 2 and n-2 (mod n) if n is prime.

For instance 2*51 = 3*34 = 4*76 = 5*81 = 1 (mod 101)  etc.

So, 99! = 2*3*4*...* 98*99=
= (2*51)*(3*34)*(5*81)*...
= 1^49 (mod 101)
= 1 (mod 101)

So 98! is just the multiplicative inverse of 99 (mod 101).
A little trial and error finds that 50*99 = 4950 = 1 (mod 101).
So 98! = 50 (mod 101).  50 is the answer to the problem.

In general, (n-3)! is the multiplicative inverse of (n-2) mod n when n is prime.  And this is always (n-1)/2.
Mod n, (n-2)*(n-1)/2 = (-2)*(n-1)/2 = 1-n = 1

 Posted by Steve Herman on 2011-09-02 22:13:01

 Search: Search body:
Forums (0)