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.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Orbit counting theorem or Burnside's Lemma
- Count of subarrays of size K having at least one pair with absolute difference divisible by K-1
- Count of Array elements to be divided by 2 to make at least K elements equal
- Smallest number whose square has N digits
- Non-repeating Primes
- Maximum sum by picking elements from two arrays in order | Set 2
- Count of elements having odd number of divisors in index range [L, R] for Q queries
- Find pair with maximum GCD for integers in range 2 to N
- Find initial sequence that produces a given Array by cyclic increments upto index P
- Minimize K whose XOR with given array elements leaves array unchanged
- Count sequences of length K having each term divisible by its preceding term
- Prefix Product Array
- Array sum after replacing all occurrences of X by Y for Q queries
- Maximum OR value of a pair in an Array | Set 2