Evaluate g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) .
Details and assumptions
The number n ! , read as n factorial , is equal to the product of all positive integers less than or equal to n . For example, 7 ! = 7 × 6 × 5 × 4 × 3 × 2 × 1 .
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.
This direct application of Euclid's algorithm is perhaps the easiest way to solve the problem. All known solutions use the ideas of Euclid's algorithm and Wilson's theorem.
In line 3, why is it not( 19!+19, (20(19!+19)-(19*20))+19)
Log in to reply
Well, from Eulcid's algorithm we know that GCD(a,b)=GCD(b,r); such that r is the rest of the Euclidean division of a by b in other words: a=bq+r with here a=20!+19 and b=19!+19
Let X = 1 8 ! , we have 1 9 ! + 1 9 = 1 9 X + 1 9 = 1 9 ( X + 1 ) and 2 0 ! + 1 9 = 3 8 0 X + 1 9 = 1 9 ( 2 0 X + 1 ) Now g cd ( 1 9 ( X + 1 ) , 1 9 ( 2 0 X + 1 ) = 1 9 ⋅ g cd ( X + 1 , 2 0 X + 1 ) and g cd ( X + 1 , 2 0 X + 1 ) = g cd ( X + 1 , ( 2 0 X + 1 ) − ( X + 1 ) ) = g cd ( X + 1 , 1 9 X ) = g cd ( X + 1 , 1 9 ) as g cd ( X , X + 1 ) = 1 .
By Wilson's Theorem (as 1 9 is prime), X = 1 8 ! ≡ − 1 m o d 1 9 and so g cd ( X + 1 , 1 9 ) = 1 9 .
Hence, g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = 1 9 ⋅ 1 9 = 3 6 1
How is gcd(X+1,19X)=gcd(X+1,19)? Thanks.
Log in to reply
thanks for the wonderful problem solving steps, even people like me who is majored in foreign language in university can understand
g c d ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = g c d ( 1 9 ! + 1 9 , 2 0 ! + 1 9 − 2 0 ( 1 9 ! + 1 9 ) ) = g c d ( 1 9 ! + 1 9 , 2 0 ! + 1 9 − 2 0 ! − 3 8 0 ) = g c d ( 1 9 ! + 1 9 , − 3 6 1 ) = g c d ( 1 9 ! + 1 9 , 3 6 1 ) = 1 9 g c d ( 1 8 ! + 1 , 1 9 ) From Wilson's Theorem we know that ( 1 9 − 1 ) ! ≡ − 1 ( m o d 1 9 ) 1 8 ! + 1 ≡ 0 ( m o d 1 9 ) It means that there exist the integer k such that 1 8 ! + 1 = 1 9 k So 1 9 g c d ( 1 8 ! + 1 , 1 9 ) = 1 9 g c d ( 1 9 k , 1 9 ) = 3 6 1 g c d ( k , 1 ) = 3 6 1
First, we subtract the first term from the second, leaving g c d ( 1 9 ! + 1 9 , 2 0 ! − 1 9 ! ) . These two numbers have a common factor of 19, which we factor out to leave 1 9 g c d ( 1 8 ! + 1 , 2 0 ∗ 1 8 ! − 1 8 ! ) = 1 9 g c d ( 1 8 ! + 1 , 1 9 ! ) .
Now we use Wilson's theorem, which I will prove here. The statement is: ( n − 1 ) ! ≡ − 1 ( m o d n ) if n is prime.
Proof: Assume n is prime. Then every number has an inverse mod n (except for 0, which is not part of the factorial). We can pair up every element with its inverse except two: The only numbers which are their own inverses mod n are n-1, or -1, and 1. Thus we have ( n − 1 ) ! ≡ 1 ∗ 1 ∗ − 1 ≡ − 1 ( m o d n ) . QED
With Wilson's theorem out of the way, we can easily finish the problem: Since x and x+1 are relatively prime for any x, 1 8 ! is relatively prime to 1 8 ! + 1 . Thus the only possible extra common divisor is 19, and by Wilson's theorem, it does divide 1 8 ! + 1 . Thus the answer is 1 9 ∗ 1 9 = 3 6 1 .
We first note that both terms have a factor of 19: 19! + 19 = 19(18! + 1) 20! + 19 = 19(20 18! + 1) We now need to check if the terms 18! + 1 and 20 18! + 1 have any factors in common. Recall the fundamental idea of Euclid's algorithm: if a number divides two numbers, then it divides any linear combination of these numbers. We notice a useful linear combination: (20 18! + 1) - 20(18! + 1) = -19 We think to use this because it eliminates the 18!, which is the most troubling term. So any other common factor of these terms divides -19, which is prime, so we need only check if 19 divides both terms. Note that 20 \equiv 1 (mod 19), so 20 18! + 1 \equiv 18! + 1 (mod 19). Hence if one of these is 0 (mod 19), then both are divisible by 19. We write out the product 18! and reduce terms (mod 19): 18 * 17 * ... * 3 * 2 * 1 \equiv (-1)(-2)...(-8)(-9)(9)(8)...(2)(1) \equiv -1 Hence 18! + 1 \equiv 0 (mod 19), so 18! + 1 and 20*18! + 1 are both divisible by 19. Hence gcd(19! + 19, 20! + 19) = 19^2 = 361.
We apply the Euclidean Algorithm on the two numbers, so gcd(20!+19, 19!+19)=gcd(19!+19, 19 19!)=gcd(19(18!+1), 19^2 18!). By Wilson's Theorem, 18!+1 is divisible by 19. However, (18!+1)/19 and 18! must be relatively prime, so the gcd must be 19^2=361.
We basically need to find g c d ( 1 9 ( 1 8 ! + 1 ) , 1 9 ( 2 0 ( 1 8 ! ) + 1 ) . This is clearly equal to 1 9 ∗ g c d ( 1 8 ! + 1 , 2 0 ( 1 8 ! ) + 1 ) . So the issue here is to find g c d ( 1 8 ! + 1 , 2 0 ( 1 8 ! ) + 1 ) = g c d ( 1 8 ! + 1 , ( 1 8 ! + 1 ) + 1 9 ) . So if 1 9 does not divide 1 8 ! + 1 the g c d will be 1 9 . But Wilson's theorem states that if p is a prime, then we have that ( p − 1 ) ! ≡ − 1 ( m o d p ) . So 1 9 ∣ 1 8 ! + 1 . Clearly, g c d ( 1 8 ! + 1 , ( 1 8 ! + 1 ) + 1 9 ) cannot be bigger than 1 9 . So the desired g c d can only be 1 9 ∗ 1 9 = 3 6 1 .
According to Euclid Algorithm, we can change 20! + 19 into:
20! + 19 = 19 \times (19! + 19) + (19! - 342) 19! + 19 = 1 \times (19! - 342) + 361
From this point, then we can change 19! - 342 into:
19! - 342 = 19 \times (18! - 18)
According to Wilson's Theorem, (n - 1)! \equiv -1 \pmod n if and only if n is prime. Since 18 + 1 = 19 is prime, then:
18! - 18 \equiv -1 \pmod 19 - 18 \pmod 19 18! - 18 \equiv -19 \pmod 19 18! - 18 \equiv 0 \pmod 19
Hence, 18! - 18 is divisible by 19. Then, 19 \times (18! - 18) = 19! - 342 is divisible by 19 \times 19 = 361, and so does:
Therefore, \gcd (19! + 19, 20! + 19) = 361.
19!+19 = 19(18!+1). Similarly, 20!+19 = 19( 18!*20 + 1) = 19 ( 18! + 19! + 1 ) .... ( By writing 20 = 19 + 1) Now Wilson's theorem says (p-1)! ≡ -1 mod p where p is a prime. This clearly shows that 18!+1 is a multiple of 19. Let us write 18!+1 to be of the form 19k. Now,
19!+19 = 361k.
And
20!+19 on a bit simplifying gives 361(k + 18!). If we somehow prove that there is no common factor of k + 18! and k, then we are done with the job. For the above result, 18! should not divide k. ............... eqn 1. We can write k as (18!+1)/ 19 .................. eqn 2.
By using 1 and 2, we have,
18!/k = (19!)/(18!+1) which can never be an integer. :)
Thus GCD = 361.
We use the property that gcd (k,n)=gcd(n-k,k). From this, gcd(19!+19,20!+19)=gcd(19!+19,19x19!). Subtract the second term from 19 times the first term yielding gcd(361,361x18!)=361.
19! + 19=19(18! + 1)
20! + 19=19(20 * 18! + 1)=19(19 * 18! + 18! + 1)
By Wilson's Theorem, which states that a natural number n > 1 is a prime number if and only if
(n-1)! ≡ -1 (mod n)
since 19 is a prime number, we have
18! + 1 ≡ 0 (mod 19)
we can factor another 19 out from both (19(19 * 18! + 18! + 1)) and (19(18! + 1))
we get
gcd(361(18! + (18! + 1)/19) , 361((18! + 1)/19))
It's not hard to see that (18! + (18! + 1)/19) and (18! + 1)/19 are coprime.
therefore gcd(19!+19,20!+19) = 361
Using rules of GCD, we have
g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = g cd ( 1 9 ! + 1 9 , 2 0 ! − 1 9 ! ) = g cd ( 1 9 ! + 1 9 , 1 9 ! × 1 9 ) = 1 9 g cd ( 1 8 ! + 1 , 1 9 ! ) = 1 9 g cd ( 1 8 ! + 1 , 1 9 )
where the last step follows because no integer less than 1 8 will divide 1 8 ! + 1 .
Now, by Wilson's theorem, since 19 is a prime, we know that 1 8 ! + 1 ≡ 0 ( m o d 1 9 ) .
Hence, the answer is 1 9 × 1 9 = 3 6 1 .
1 2 3 4 5 6 |
|
1 |
|
Problem Loading...
Note Loading...
Set Loading...
We know that 2 0 ! = 2 0 ( 1 9 ! + 1 9 ) − 1 9 ⋅ 2 0 .
From Euclid's Algorithm, we have g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = g cd ( 1 9 ! + 1 9 , − 1 9 ⋅ 2 0 + 1 9 ) , or g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = g cd ( 1 9 ! + 1 9 , 1 9 2 ) .
Since 1 9 ! + 1 9 = 1 9 ( 1 8 ! + 1 ) and 1 9 ∣ 1 8 ! + 1 by Wilson's Theorem, we get that 1 9 2 ∣ 1 9 ! + 1 9 .
That means g cd ( 1 9 ! + 1 9 , 1 9 2 ) = 1 9 2 , or g cd ( 1 9 ! + 1 9 , 2 0 ! + 1 9 ) = 1 9 2 = 3 6 1 , as the result.