Euclid's lemma Last Updated : 19 Nov, 2016 Comments Improve Suggest changes 20 Likes Like Report 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 Create Quiz Comment K kartik Follow 20 Improve K kartik Follow 20 Improve Article Tags : Mathematical DSA Prime Number Explore DSA FundamentalsLogic Building Problems 2 min read Analysis of Algorithms 1 min read Data StructuresArray Data Structure 3 min read String in Data Structure 2 min read Hashing in Data Structure 2 min read Linked List Data Structure 3 min read Stack Data Structure 2 min read Queue Data Structure 2 min read Tree Data Structure 2 min read Graph Data Structure 3 min read Trie Data Structure 15+ min read AlgorithmsSearching Algorithms 2 min read Sorting Algorithms 3 min read Introduction to Recursion 15 min read Greedy Algorithms 3 min read Graph Algorithms 3 min read Dynamic Programming or DP 3 min read Bitwise Algorithms 4 min read AdvancedSegment Tree 2 min read Binary Indexed Tree or Fenwick Tree 15 min read Square Root (Sqrt) Decomposition Algorithm 15+ min read Binary Lifting 15+ min read Geometry 2 min read Interview PreparationInterview Corner 3 min read GfG160 3 min read Practice ProblemGeeksforGeeks Practice - Leading Online Coding Platform 1 min read Problem of The Day - Develop the Habit of Coding 5 min read Like