# Euclid’s lemma

We are given two numbers x and y. We know that a number p divides their product. Can we say for sure that p also divides one of them?

The answer is no. For example, consider x = 15, y = 6 and p = 9. p divides the product 15*6, but doesn’t divide any of them.

**What if p is prime?**

**Euclid’s lemma** states that if a prime p divides the product of two numbers (x*y), it must divide at least one of those numbers.

For example x = 15, y = 6 and p = 5. p divides the product 15*6, it also divides 15.

The idea is simple, since p is prime, it cannot be factorized. So it must either be completely present in x or in y.

**Generalization of Euclid’s lemma:**

If p divides x*y and p is relatively prime to x, then p must divide y. In the above example, 5 is relatively prime to 6, therefore it must divide 15.

**Reference:**

https://en.wikipedia.org/wiki/Euclid’s_lemma

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

## Recommended Posts:

- Multiply Large Numbers using Grid Method
- Maximum frequency of a remainder modulo 2
^{i} - Sum of the updated array after performing the given operation
- Remove an element to minimize the LCM of the given array
- Find closest integer with the same weight
- Check whether the given decoded string is divisible by 6
- Find the minimum possible health of the winning player
- Construct an array from its pair-product
- Count of odd and even sum pairs in an array
- Number of ways to divide string in sub-strings such to make them in lexicographically increasing sequence
- Find Nth even length palindromic number formed using digits X and Y
- Minimum number to be added to all digits of X to make X > Y
- Cake Distribution Problem
- Calculate the number of set bits for every number from 0 to N