What a large number you have

What is the remainder when 709 ! 709! is divided by 719?

Details and assumptions

You may use the fact that 709 709 and 719 719 are both primes.


The answer is 515.

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.

8 solutions

Daniel Chiu
Sep 22, 2013

Note that 709 ! ( 10 ) ( 11 ) ( 718 ) ( m o d 719 ) 709!\equiv (-10)(-11)\cdots(-718) \pmod {719} Since there is an odd number of terms, this is also equivalent to 709 ! 718 ! 9 ! ( m o d 719 ) 709!\equiv -\dfrac{718!}{9!}\pmod {719} By Wilson's Theorem (iff p p is prime, ( p 1 ) ! 1 ( m o d p ) (p-1)!\equiv -1\pmod p ), 709 ! 1 9 ! ( m o d 719 ) 709!\equiv \dfrac{1}{9!}\pmod {719} Notice that 6 ! 720 1 ( m o d 719 ) 6!\equiv 720\equiv 1\pmod {719} , and so we calculate as follows: 1 9 ! 1 6 ! 1 7 8 9 1 7 8 9 ( m o d 719 ) \dfrac{1}{9!}\equiv\dfrac{1}{6!}\cdot\dfrac{1}{7\cdot 8\cdot 9}\equiv\dfrac{1}{7\cdot 8\cdot 9}\pmod{719} Now, notice that 8 9 10 1 ( m o d 719 ) 8\cdot 9\cdot 10\equiv 1\pmod {719} , and so 1 7 8 9 10 7 ( m o d 719 ) \dfrac{1}{7\cdot 8\cdot 9}\equiv \dfrac{10}{7}\pmod {719} Finally, 7 103 2 ( m o d 719 ) 7\cdot 103\equiv 2\pmod {719} , and we find our answer: 10 7 1030 2 515 ( m o d 719 ) \dfrac{10}{7}\equiv\dfrac{1030}{2}\equiv\boxed{515}\pmod {719}

Moderator note:

Great explanation. This solution also shows you how 719 was specially chosen, to reduce the amount of tedious calculation that has to be done, because 720 is so highly factorable.

You have a couple typos where you say 719! instead of 709! on your second and third math lines. Apart from that, very good solution!

Thomas Baxter - 7 years, 8 months ago

Log in to reply

Darn. Thanks

Daniel Chiu - 7 years, 8 months ago

Log in to reply

Edited.

Calvin Lin Staff - 7 years, 8 months ago

Log in to reply

@Calvin Lin Are you the challenge master?

Shreya R - 7 years ago

@Calvin Lin Any other way , unable to understand it , don't know what is mod?.got wrong

U Z - 6 years, 7 months ago

Can't it be solved without Wilson's Theorem??

Harshit Agrawal - 7 years, 8 months ago

Can you show how you got 1 7 8 9 10 7 ( m o d 719 ) \frac{1}{7 \cdot 8 \cdot 9} \equiv \frac{10}{7} \pmod {719} ?

minimario minimario - 7 years, 8 months ago

Log in to reply

Notice that 8 9 10 1 ( m o d 719 ) 8\cdot 9\cdot 10\equiv 1 \pmod{719} Then 1 7 8 9 10 7 8 9 10 10 7 ( m o d 719 ) \dfrac{1}{7\cdot 8\cdot 9}\equiv\dfrac{10}{7\cdot 8\cdot 9\cdot 10}\equiv \dfrac{10}{7}\pmod{719}

Daniel Chiu - 7 years, 8 months ago

Log in to reply

I still don't get it, i know if 8 9 10 1 ( m o d 719 ) 8⋅9⋅10≡1(mod719) but how to do this 10 / 7 8 9 10 10 / 7 10/7⋅8⋅9⋅10≡10/7 ( m o d 719 ) (mod719) can happen? the 7 no included to be mod?

then ater that, 10 / 7 1030 / 2 515 ( m o d 719 ) 10/7≡1030/2≡515(mod719) only 7 who get mod?

Hafizh Ahsan Permana - 7 years, 8 months ago

Log in to reply

@Hafizh Ahsan Permana So, you understand why 8 9 10 1 ( m o d 719 ) 8\cdot 9\cdot 10\equiv 1\pmod{719} .

Now, multiply by 10 10 \dfrac{10}{10} : 1 7 8 9 1 7 8 9 10 10 10 7 8 9 10 10 7 ( 8 9 10 ) 10 7 1 10 7 ( m o d 719 ) \begin{aligned} \dfrac{1}{7\cdot 8\cdot 9}&\equiv \dfrac{1}{7\cdot 8\cdot 9}\cdot \dfrac{10}{10}\equiv\dfrac{10}{7\cdot 8\cdot 9\cdot 10}\equiv\dfrac{10}{7\cdot(8\cdot 9\cdot 10)} \\ &\equiv\dfrac{10}{7\cdot 1}\equiv\dfrac{10}{7}\pmod{719} \end{aligned}

The other step is similar.

Daniel Chiu - 7 years, 8 months ago

What an elegant solution!

Mark Lao - 7 years, 8 months ago

mind telling me how you got to 709! ≡ (−10)(−11)⋯(−718) (mod719) ?

Daniel Magen - 7 years, 8 months ago

Log in to reply

We know that 709 10 ( m o d 719 ) 709\equiv -10\pmod{719}

This is because equivalence modulo 719 means that, for an integer k k , 709 + 719 k = 10 709+719k=-10 This equation is satisfied for k = 1 k=-1 .

Similarly, 708 11 ( m o d 719 ) 708\equiv -11\pmod{719} and so on.

Daniel Chiu - 7 years, 8 months ago

1 = -718, 2 = -717, ..., 709 = -10 (all equal signs meaning congruence mod 719).

Marek Bernat - 7 years, 8 months ago

Ingenious but I don't get the part where 'since there is an odd number of terms...' what happens if there are an even number of terms?

A Former Brilliant Member - 7 years, 8 months ago

Log in to reply

There is an odd number of terms. If there was an even number of terms the answer would have a negative sign in front.

Daniel Chiu - 7 years, 8 months ago
Ryan Broder
Sep 23, 2013

Since 719 719 is prime, we can apply Wilson's Theorem to get that 718 ! 1 718! \equiv -1 m o d mod 719 719 . This can be written as

709 ! 710 711 718 709 ! 9 8 1 709 ! 9 ! 1 709! \cdot 710 \cdot 711 \cdots 718 \equiv 709! \cdot -9 \cdot -8 \cdots -1 \equiv 709! \cdot -9! \equiv -1 m o d mod 719 719 .

This give us 709 ! 72 7 720 1 709! \cdot 72 \cdot 7 \cdot 720 \equiv 1 m o d mod 719 719 .

We now reduce the expression m o d mod 719 719 :

709 ! 72 7 720 1 + 719 720 709! \cdot 72 \cdot 7 \cdot 720 \equiv 1+719 \equiv 720

709 ! 72 7 1 + 719 720 709! \cdot 72 \cdot 7 \equiv 1+719 \equiv 720

709 ! 7 10 + 5 719 3605 709! \cdot 7 \equiv 10+ 5 \cdot 719 \equiv 3605

709 ! 515 709! \equiv 515

Thus the remainder when 709 ! 709! is divided by 709 709 is 515 515

Moderator note:

Very nice! Your reductions modulo 719 719 are a bit unusual, but very effective.

Very precise and comprehensible. the reductions were very clear and understandable. Thank you for your solution.

Jayant Kumar - 7 years, 8 months ago
Jan J.
Sep 23, 2013

We are given that 719 719 is prime, hence by Wilson's theorem 718 ! 1 ( m o d 719 ) 718! \equiv -1 \pmod{719} Therefore 709 ! 710 711 718 709 ! ( 9 ) ( 8 ) ( 7 ) ( 1 ) ( m o d 719 ) 9 ! 709 ! ( m o d 719 ) 215 709 ! ( m o d 719 ) \begin{aligned} 709! \cdot 710 \cdot 711 \cdots 718 &\equiv 709! \cdot (-9)(-8)(-7) \cdots (-1) \pmod{719} \\ &\equiv -9! \cdot 709! \pmod{719} \\ &\equiv 215 \cdot 709! \pmod{719} \end{aligned} Hence 215 709 ! 1 ( m o d 719 ) 215 \cdot 709! \equiv -1 \pmod{719} This is linear congruence generally solvable by Euclidean algorithm. Thus using Euclidean algorithm we get 709 ! 515 ( m o d 719 ) 709! \equiv 515 \pmod{719}

The Euclidean Algorithm works, of course. But easier solutions exist in this particular case.

Alexander Borisov - 7 years, 8 months ago

How does the -9! change to 215?

LAW HUI HUANG - 7 years, 8 months ago
Alex Wice
Sep 22, 2013

Let p=719. By wilsons theorem, 718! == 1 mod p == 709! * (-9)(-8)(-7)...(-1) == 709! (504) where == denotes equivalence. We can solve for the residue of 709! trivially from here.

Adnan Van Dal
Sep 26, 2013

(p-1)!=-1 mod p by Wilson's theorem. Hence 709!x710x711...718=718 mod 719. To make the arithmetic simpler equivalently we have: 709!x(-9)(-8)...(-3)(-2)=1 mod 719 or 709!x(-1)^8x9x8x7x6!=1 mod 719 but note that 719 = 6!-1 hence 709!x9x8x7x(719+1)=1 mod 719 i.e. 709!x9x8x7=1 mod 719. Hence we just need to find the multiplicative inverse of 9x8x7 = 504 in the group mod 719. This can be done by Euclid's Algorithm since hcf(504,719)=1 means there exist a,b in Z such that 504xa+719xb=1, in which case a = 504^(-1), hence 709! = a mod 719. This yields the answer given.

Sean Gee
Sep 28, 2013

The question can be translated into: "What is 709! mod 719?"

As 719 is prime, use Wilson's Theorem, and we get 718! mod 719 = 718. We then work backwards.

717! mod 719 = a, where a is an integer such that 718a mod 719 = 718. We solve the equation and get a = 1. Work backwards similarly, until we get the desired answer, that is: 709! mod 719 = 515.

Nam Diện Lĩnh
May 9, 2014

We calculate the remainder by using a simple loop in javascript:

var n=1;
for(var i=2 ; i <= 709 ; i++)
    n = n * i % 719;

which will multiply all 709 number and get the remainder for each turn. Because 709 is rather small, we can afford this.

Ariel Gershon
Sep 25, 2013

By Wilson's Theorem, since 719 is prime we have 718! = -1 (mod 719). Now, 718! = 709! * 710 * 711 * ... * 718. Since we're working mod 719, we can rewrite 710 as -9, 711 as -8, and so on up to 718 as -1. Therefore, 709! * (-9!) = -1 (mod 719). Hence 709! * (9!) = 1 (mod 719). Now observe that 6! = 720 = 1 (mod 719), so we can cancel a 6! out of the 9 factorial. We get 709! * (7 * 8 * 9) = 1 (mod 719), so 709! = (504)^(-1) (mod 719). To find the inverse of 504 we simply use the Bezout algorithm, and get 515.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...