GCD of Factorials!

Find the GCD of ( 19 ! + 19 , 20 ! + 19 ) . (19! + 19, 20! + 19).


Note: GCD stands for the greatest common divisor.


The answer is 361.

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.

10 solutions

Jackson Abascal
Nov 9, 2014

(I'm only a math enthusiast in my free time, and this is the first longer proof I've ever written. Sorry if anything is unclear or different from accepted standards)

I used a combination of simple division, Euclid's GCD algorithm, and Wilson's Theorem to solve the problem.

We can first see that both 19 ! + 19 19!+19 and 20 ! + 19 20!+19 are divisible by 19. Therefore G C D ( 20 ! + 19 , 19 ! + 19 ) = 19 G C D ( 18 ! ( 20 ) + 1 , 18 ! + 1 ) GCD(20! + 19, 19! + 19) = 19*GCD(18!(20) + 1, 18! + 1) .

To apply Euclid's GCD algorithm to these numbers, we need to find ( 18 ! ( 20 ) + 1 ) m o d ( 18 ! + 1 ) . ( 18 ! + 1 ) 19 (18!(20) + 1) mod (18! + 1). (18! + 1)*19 is the largest multiple of ( 18 ! + 1 ) (18! + 1) that doesn't exceed 18 ! ( 20 ) + 1 18!(20) + 1 so

( 18 ! ( 20 ) + 1 ) m o d ( 18 ! + 1 ) = 18 ! ( 20 ) + 1 ( 18 ! + 1 ) ( 19 ) = 18 ( 20 ) + 1 18 ! ( 19 ) 19 = 18 ! 18 (18!(20)+1) mod (18!+1)\\ =18!(20)+1-(18!+1)(19)\\ =18(20)+1-18!(19)-19\\ =18!-18

Therefore G C D ( 18 ! ( 20 ) + 1 , 18 ! + 1 ) = G C D ( 18 ! + 1 , 18 ! 18 ) GCD(18!(20) + 1, 18! + 1) = GCD(18! + 1, 18! - 18)

One more iteration of Euclid's gives us G C D ( 18 ! 18 , 19 ) GCD(18! - 18, 19)

If and only if 18! - 18 is divisible by 19, then ( 18 ! 18 + 19 ) = ( 18 ! + 1 ) (18! - 18 + 19) = (18! + 1) must be also.

A slight rearrangement of Wilson's Theorem tells us that n! + 1 is divisible by n if n is prime. 19 is prime, therefore G C D ( 18 ! 18 , 19 ) = 19 GCD(18! - 18, 19) = 19

Substituting 19 into the GCD equivalence found earlier, we can see that 19 G C D ( 18 ! ( 20 ) + 1 , 18 ! + 1 ) = 19 2 = 361 19*GCD(18!(20)+1,18!+1)\\ ={ 19 }^{ 2 }\\=361

Great job with your first longer proof!

FYI, the Latex for mod is a \equiv b \pmod{n}, which produces a b ( m o d n ) a \equiv b \pmod{n} .

Calvin Lin Staff - 6 years, 7 months ago

Great answer to my sense, I’m also a math enthusiast in free time but not as nearly good, I wonder, did you have all this planned out ahead of the time ?

Tony Yin - 3 years ago
U Z
Nov 9, 2014

19 ! + 19 = 19 ( 18 ! + 1 ) = x 19! + 19 = 19(18! + 1)= x

20 ! + 19 = 19 ( 20.18 ! + 1 ) = 19 ( ( 19 + 1 ) 18 ! + 1 ) = 1 9 2 18 ! + x 20! + 19 = 19(20.18! + 1) = 19( (19 + 1)18! + 1) = 19^{2}18! + x

By Euclid's algorithm,

g c d ( 19 ! + 19 , 20 ! + 19 ) = g c d ( 19 ! + 19 , 1 9 2 18 ! ) gcd( 19! + 19 , 20! + 19) = gcd( 19! + 19 , 19^{2}18!)

19 ! + 19 = 19 ( 18 ! + 1 ) 19! + 19=19(18! + 1) and 19 18 ! + 1 19|18! + 1 . By wilson theorem , we get 1 9 2 19 ! + 19 19^{2}|19! + 19

Thus

g c d ( 19 ! + 19 , 20 ! + 19 ) = 361 gcd( 19! + 19 , 20! + 19) =361

I think you skipped several steps in the "By Euclid's algorithm". Can you flesh out the working? Thanks!

Calvin Lin Staff - 6 years, 7 months ago

Log in to reply

Edited @Calvin Lin

U Z - 6 years, 7 months ago

Log in to reply

Right, that adds more explanations, but you are still missing one step. Specifically, the step that you skipped was to show that

gcd ( 19 ! + 19 1 9 2 , 18 ! ) = 1 \gcd( \frac{ 19! + 19 } { 19^2 } , 18 ! ) = 1

This is because what you have only shown so far, is that gcd ( 19 ! + 19 , 1 9 2 18 ! = 1 9 2 gcd ( 19 ! + 19 1 9 2 , 18 ! ) \gcd ( 19! + 19 , 19^2 18! = 19^2 \gcd( \frac{ 19! + 19 } { 19^2 } , 18 ! ) .

Calvin Lin Staff - 6 years, 7 months ago

ooohhh. typo: 381 should be 361...

敬全 钟 - 6 years, 7 months ago

Log in to reply

Thank you , edited

U Z - 6 years, 7 months ago

How do I know when to stop. I mean there could be another common factor and how to prove it doesn't exist?

leon lin - 3 years, 1 month ago

Log in to reply

Show that there is integers m, n as the coefficient of the divided number of the two as their linear combination coefficient and that their smallest result is 1 to stop there are no further steps to proceed on.

Tiancheng Xue - 1 year, 1 month ago
Johan Kurniawan
Nov 11, 2014

See the patterns

GCD(2!+2 , 3!+2) = 2

GCD (3!+3 , 4!+3) = 9 ( 3x3)

GCD (4!+4 , 5!+4) = 4

GCD (5!+5 , 6!+ 5) = 25 (5x5)

if even number we can take the same number And if odd number we can use quadratic

So

GCD (19!+19,20!+19) = 19x19 = 361

Sorry for idiot solutons But is it work?

Johan Kurniawan - 6 years, 7 months ago

Hey,this is not a solution. @Johan Kurniawan

Anuj Shikarkhane - 6 years, 7 months ago

Nice observation!

Harsh Shrivastava - 6 years, 6 months ago

as good as a theorem

Eugenza Ryn - 4 years, 11 months ago

This is incorrect. Check for x = 9. gcd(9! + 9, 10! + 9) =9 and not 81.

I think it works for only prime numbers. Because for x= 11 or 13 the gcd is 121 and 169 respectively. But again for x= 15, the gcd is 15. I don't know if it will fail for some higher numbers.

HARSHIT KUMAR - 11 months, 1 week ago

I am considering like this:

Suppose gcd ( 19 ! + 19 , 20 ! + 19 ) = g \gcd(19!+19,20!+19)=g . Then we have 19 ! + 19 0 ( m o d g ) 19!+19\equiv 0\pmod{g} and hence 19 ! 19 ( m o d g ) 19!\equiv -19\pmod{g} .

Note that 20 ! = 20 19 ! 20!=20\cdot 19! , so 20 ! 380 ( m o d g ) 20!\equiv -380\pmod{g} and then 20 ! + 19 361 ( m o d g ) 20!+19\equiv -361\pmod{g} .

Since 20 ! + 19 0 ( m o d g ) 20!+19\equiv 0\pmod{g} , we will have g = 361 g=361 .

Ankit Chabarwal
Oct 19, 2016

Since, ( a , b ) = ( a b , b ) (a,b)=(a-b,b) and ( k a , k b ) = k ( a , b ) (ka,kb)=k(a,b)

So, ( 19 ! + 19 , 20 ! + 19 ) = ( 19 ! + 19 , 20 ! 19 ! ) = 19 ( 18 ! + 1 , 19 ! ) (19!+19, 20!+19) = (19!+19, 20!-19!) = 19(18!+1,19!)

From Wilson's theorem we have

18 ! 1 ( m o d 19 ) 18! \equiv -1 \pmod {19} 19 ( 18 ! + 1 ) \implies 19|(18!+1)

So, the smallest non-unity divisor of 18 ! + 1 18! + 1 is 19 19 . Therefore, ( 18 ! + 1 , 19 ! ) = 19 (18!+1,19!)=19 .

So, finally we have ( 19 ! + 19 , 20 ! + 19 ) = 19 19 = 361 (19!+19, 20!+19)=19*19=\boxed {361} .

Laurent Shorts
Mar 5, 2016

Solution without Wilson's theorem

Using Euclid's GCD algorithm:

20 ! + 19 20!+19 L 1 L_1
19 ! + 19 19!+19 L 2 L_2
19 19 ! 19·19! L 3 = L 1 L 2 L_3=L_1-L_2
1 9 2 19^2 L 4 = 19 L 2 L 3 L_4=19L_2-L_3

It's then easy to see that G C D ( 20 ! + 19 , 19 ! + 19 ) = G C D ( 19 19 ! , 1 9 2 ) = 1 9 2 GCD(20!+19,19!+19)=GCD(19·19!,19^2)=19^2 .

Shiv Gupta
Nov 11, 2014

GCD(19!+19, 20!+19) = 19* GCD(18!+1, 20* 18!+1) ........(A)

GCD(18!+1, 20*18!+1) = GCD(18!+1, 19!) .....(B) (why?) since GCD(a,b) = GCD(a, b-a)

now Wilson's theorem suggests 18! = -1 (mod 19) hence 18!+1 will be 0 (mod 19) and 19! also contains 19.

so GCD(18!+1, 19!) = 19 ...........................(C)

and from A, B and C ans is 19*19=361.

Noel Lo
Jun 27, 2018

To generalise, for any prime p p , we have that ( p ! + p , ( p + 1 ) ! + p ) = p 2 (p!+p, (p+1)!+p)=p^2 . Why?

p ! + p = p ( ( p 1 ) ! + 1 ) p!+p=p((p-1)!+1) and ( p + 1 ) ! + p = ( p + 1 ) p ( p 1 ) ! + p = p ( ( p + 1 ) ( p 1 ) ! + 1 ) (p+1)!+p=(p+1)p(p-1)!+p=p((p+1)(p-1)!+1) . Note that ( p + 1 ) ( p 1 ) ! + 1 1 ( p 1 ) ! + 1 = ( p 1 ) ! + 1 (p+1)(p-1)!+1 \equiv 1(p-1)!+1 = (p-1)!+1 (mod p p ). According to Wilson's Theorem, p ( p 1 ) ! + 1 p \mid (p-1)!+1 and thus p ( p + 1 ) ( p 1 ) ! + 1 p \mid (p+1)(p-1)!+1 as well. This means p 2 p ( ( p 1 ) ! + 1 ) p^2 \mid p((p-1)!+1) and p 2 p ( ( p + 1 ) ( p 1 ) ! + 1 ) p^2 \mid p((p+1)(p-1)!+1) .

Barometer Nongbri
Nov 14, 2014

Best Ans : Let 19! + 19 = a , 20! + 19 = 19!+ 19 + 19^2x 18! = a+ 361x18! Use GCD(a , a+b) = GCD(a ,b) whichever theorem you may call to get required GCD = GCD ( 19! + 19 , 361x18!) = 19xGCD(18!+ 1 , 19x18!) = 361xGCD{(18!+1)/19 , 18!} = 361 x 1 = 361 as GCD{(18!+1) , 18!} = 1

(Note that (18!+1)/19 is an integer by Wilson's theorem

Manish Goel
Nov 10, 2014

19!+19 = nq » 20(19!)= 20nq - 380

20!+19=mq » 20(19!)=mq-19

Equating the two equations and rearranging gives: (20n-m)q=361

Which implies that maximum possible q is 361 when (20n-m) =1

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...