WishWasTraining Academy
CDS exam school
โ† home
Chapter A1-5 ยท 5 of 6 in Numbers ยท 17 min read

HCF and LCM of numbers; Euclid's algorithm

18 real CDS questions of this kind in the 6 papers from CDS I 2024 to CDS II 2026.

Revision sheet: the chapter on one pageTry three questions free โ†“
This chapter has a video lessonWatch it, practise with a drill and keep your record, all with a free account. No fee, no card.

Why this chapter matters. This chapter gave 18 questions in the 6 papers from CDS I 2024 to CDS II 2026, three in a paper on average, and six in CDS I 2026 alone. Five of the 18 are "remainder" word problems: the smallest or greatest number that leaves given remainders. Five use the link between two numbers, their HCF and their LCM. Four use the idea behind Euclid's algorithm: the HCF does not change when one number is replaced by a sum or a difference. Three are practical (the HCF or LCM of decimals, the largest square tile), and one is a statement question on primes. One of the 18 was dropped by UPSC because no option was right.

What you will be able to do

  • Find the HCF and LCM of numbers by prime factors, and the HCF of two large numbers by Euclid's algorithm.
  • Use โ€‹\text{HCF} \times \text{LCM} = \text{product}โ€‹ for two numbers, and write two numbers as โ€‹Haโ€‹ and โ€‹Hbโ€‹.
  • Find the HCF and LCM of fractions and decimals.
  • Read a word problem and decide at once: HCF or LCM, and of which numbers.

Before you start you should know: prime factorisation and co-prime numbers (Chapter A1-3), and the division rule, dividend โ€‹=โ€‹ divisor โ€‹\timesโ€‹ quotient โ€‹+โ€‹ remainder (Chapter A1-4).

1. What HCF and LCM are

The HCF (highest common factor) of two or more numbers is the largest number that divides each of them exactly. It is also called the GCD. The LCM (least common multiple) is the smallest number that each of them divides exactly.

By prime factors. Write each number as a product of prime powers.

  • HCF: take only the primes common to all, each with its lowest power.
  • LCM: take every prime that appears, each with its highest power.

For โ€‹12 = 2^2 \times 3โ€‹ and โ€‹18 = 2 \times 3^2โ€‹: the HCF is โ€‹2 \times 3 = 6โ€‹ and the LCM is โ€‹2^2 \times 3^2 = 36โ€‹.

Three facts to keep in mind:

  • The HCF is never more than the smallest number. The LCM is never less than the largest.
  • The HCF divides the LCM. Every number of the set is a multiple of the HCF and a factor of the LCM.
  • If two numbers are co-prime, their HCF is 1 and their LCM is their product. This holds for any two different primes.

2. Euclid's algorithm

Prime factors are slow for large numbers. Euclid's algorithm uses division only.

Method. Divide the larger number by the smaller. Then divide the old divisor by the remainder. Go on until the remainder is 0. The last divisor is the HCF.

For 48 and 18: โ€‹48 = 18 \times 2 + 12โ€‹, then โ€‹18 = 12 \times 1 + 6โ€‹, then โ€‹12 = 6 \times 2 + 0โ€‹. The HCF is 6.

Why it works. A number that divides both โ€‹pโ€‹ and โ€‹qโ€‹ also divides โ€‹p + qโ€‹, โ€‹p - qโ€‹ and the remainder when โ€‹pโ€‹ is divided by โ€‹qโ€‹. And a number that divides โ€‹qโ€‹ and that remainder also divides โ€‹pโ€‹. So the common factors do not change at any step:

\text{HCF}(p, q) = \text{HCF}(p, p + q) = \text{HCF}(p, p - q) = \text{HCF}(q, \text{remainder})

Check with 12 and 8, whose HCF is 4: the HCF of 12 and 20 is 4, and the HCF of 12 and 4 is 4.

This idea is asked directly. Two uses:

  • Two numbers next to each other are co-prime, because their HCF must divide their difference, 1.
  • To show that two expressions are co-prime, combine them so that the letter cancels. If the result is 1 or โ€‹-1โ€‹, the HCF is 1.

3. Two numbers, their HCF and their LCM

For two numbers โ€‹xโ€‹ and โ€‹yโ€‹:

\text{HCF} \times \text{LCM} = x \times y

Check with 12 and 18: โ€‹6 \times 36 = 216 = 12 \times 18โ€‹.

This is not true for three numbers. For 2, 4 and 6 the HCF is 2 and the LCM is 12, which gives 24, but the product is 48.

The form โ€‹Haโ€‹, โ€‹Hbโ€‹. If the HCF of two numbers is โ€‹Hโ€‹, write them as โ€‹Haโ€‹ and โ€‹Hbโ€‹, where โ€‹aโ€‹ and โ€‹bโ€‹ are co-prime. Then

\text{LCM} = Hab

Most questions that give a ratio, a sum or an HCF are solved from this form. If two numbers are in the ratio โ€‹3 : 4โ€‹, they are โ€‹3kโ€‹ and โ€‹4kโ€‹; since 3 and 4 are co-prime, the HCF is โ€‹kโ€‹ and the LCM is โ€‹12kโ€‹.

4. Fractions and decimals

For fractions in lowest terms:

Rule For โ€‹\dfrac{2}{3}โ€‹ and โ€‹\dfrac{4}{9}โ€‹
HCF โ€‹\dfrac{\text{HCF of the numerators}}{\text{LCM of the denominators}}โ€‹ โ€‹\dfrac{2}{9}โ€‹
LCM โ€‹\dfrac{\text{LCM of the numerators}}{\text{HCF of the denominators}}โ€‹ โ€‹\dfrac{4}{3}โ€‹

Decimals. Give every number the same count of decimal places, drop the points, find the HCF or LCM of the whole numbers, and put the point back. For โ€‹1.8โ€‹ and โ€‹4.5โ€‹: work with 18 and 45. Their HCF is 9 and their LCM is 90. So the HCF is โ€‹0.9โ€‹ and the LCM is โ€‹9.0โ€‹.

5. Word problems: HCF or LCM?

Words such as "greatest", "largest", "maximum" with "divides" point to the HCF. Words such as "least", "smallest", "together again" with "divisible by" point to the LCM. Call the LCM of the divisors โ€‹Lโ€‹.

The question asks for Find
the greatest number that divides โ€‹aโ€‹ and โ€‹bโ€‹ exactly; the largest square tile; the greatest speed or longest tape that measures both exactly HCF of โ€‹aโ€‹, โ€‹bโ€‹
the greatest number that divides โ€‹aโ€‹, โ€‹bโ€‹, โ€‹cโ€‹ leaving the same remainder HCF of the differences โ€‹b - aโ€‹, โ€‹c - bโ€‹, โ€‹c - aโ€‹
the greatest number that divides โ€‹aโ€‹ and โ€‹bโ€‹ leaving remainders โ€‹rโ€‹ and โ€‹sโ€‹ HCF of โ€‹a - rโ€‹ and โ€‹b - sโ€‹
the least number divisible by each of several numbers; when bells ring together again โ€‹Lโ€‹
a number that leaves the same remainder โ€‹rโ€‹ with each divisor โ€‹L \times k + rโ€‹
a number whose remainders fall short of the divisors by the same amount โ€‹dโ€‹ โ€‹L \times k - dโ€‹

In the last two rows โ€‹kโ€‹ is 1, 2, 3, ... Choose the โ€‹kโ€‹ that the question needs: the smallest 4-digit number, the largest 5-digit number, a multiple of 11.

How to see the last row. Divisors 6, 12, 15 with remainders 2, 8, 11: each remainder is 4 less than its divisor. So the number is 4 short of a multiple of each divisor. Add 4 to it and it becomes a common multiple.

Worked examples

Example 1. Find the HCF and the LCM of 84 and 360.

โ€‹84 = 2^2 \times 3 \times 7โ€‹ and โ€‹360 = 2^3 \times 3^2 \times 5โ€‹. The common primes with their lowest powers give the HCF: โ€‹2^2 \times 3 = 12โ€‹. All the primes with their highest powers give the LCM: โ€‹2^3 \times 3^2 \times 5 \times 7 = 2520โ€‹. Check: โ€‹12 \times 2520 = 30240 = 84 \times 360โ€‹.

Example 2. Find the HCF of 1071 and 462.

โ€‹1071 = 462 \times 2 + 147โ€‹. Then โ€‹462 = 147 \times 3 + 21โ€‹. Then โ€‹147 = 21 \times 7 + 0โ€‹. The last divisor is 21, so the HCF is 21.

Example 3. The HCF of two numbers is 12 and their LCM is 360. One number is 72. Find the other. How many pairs of numbers have this HCF and this LCM?

The other number is โ€‹\dfrac{12 \times 360}{72} = 60โ€‹. For the count, write the numbers as โ€‹12aโ€‹ and โ€‹12bโ€‹ with โ€‹aโ€‹, โ€‹bโ€‹ co-prime. Then โ€‹12ab = 360โ€‹, so โ€‹ab = 30โ€‹. The co-prime pairs are 1 and 30, 2 and 15, 3 and 10, 5 and 6. So there are 4 pairs: 12 and 360, 24 and 180, 36 and 120, 60 and 72.

Example 4. (i) Find the smallest 3-digit number that leaves remainder 3 when divided by 8, 12 and 18. (ii) Find the smallest number that leaves remainders 5, 9 and 15 when divided by 8, 12 and 18.

The LCM of 8, 12 and 18 is โ€‹2^3 \times 3^2 = 72โ€‹. (i) The numbers are โ€‹72k + 3โ€‹: 75, 147, ... The smallest with three digits is 147. (ii) Each remainder is 3 short of its divisor: โ€‹8 - 5 = 12 - 9 = 18 - 15 = 3โ€‹. So the number is โ€‹72 - 3 = 69โ€‹. Check: โ€‹69 = 8 \times 8 + 5 = 12 \times 5 + 9 = 18 \times 3 + 15โ€‹.

Example 5. Find the greatest number that divides 77, 147 and 252 leaving the same remainder in each case.

If two numbers leave the same remainder, the divisor divides their difference exactly. The differences are โ€‹147 - 77 = 70โ€‹, โ€‹252 - 147 = 105โ€‹ and โ€‹252 - 77 = 175โ€‹. Their HCF is 35. Check: 77, 147 and 252 each leave 7 on division by 35.

From the real papers

The first three questions are from CDS I 2025 and CDS II 2025 (Series A), and the answers agree with the final official key. The next three are from CDS I 2026, where the official key is still provisional; our answers agree with it. Try each for 72 seconds before reading the solution.

CDS II 2025, Q30. A number โ€‹Nโ€‹ is such that when divided by 4, 6, 7 or 9, it leaves 3 as remainder. What is the smallest 4-digit number that satisfies this property?

(a) 1003โ€ƒโ€ƒ(b) 1005โ€ƒโ€ƒ(c) 1007โ€ƒโ€ƒ(d) 1011

Solution. The same remainder each time, so โ€‹N = L \times k + 3โ€‹ (section 5). The LCM of 4, 6, 7 and 9 is โ€‹2^2 \times 3^2 \times 7 = 252โ€‹. Its multiples are 252, 504, 756, 1008, ... Now โ€‹756 + 3 = 759โ€‹ has three digits, and โ€‹1008 + 3 = 1011โ€‹ has four. Answer (d).

CDS II 2025, Q15. If โ€‹nโ€‹ is natural number less than 7, then what is the number of values of โ€‹nโ€‹ for which โ€‹(12n+2)โ€‹ and โ€‹(8n+1)โ€‹ are relatively prime?

(a) 6โ€ƒโ€ƒ(b) 5โ€ƒโ€ƒ(c) 4โ€ƒโ€ƒ(d) 3

Solution. Do not test six values. A common factor of the two numbers must divide any combination of them (section 2). Choose the one in which โ€‹nโ€‹ cancels: โ€‹3(8n + 1) - 2(12n + 2) = 24n + 3 - 24n - 4 = -1โ€‹. So the HCF divides 1, and the two numbers are relatively prime for every โ€‹nโ€‹. All six values โ€‹n = 1, 2, \dots, 6โ€‹ work. Answer (a).

CDS I 2025, Q85. Consider the following statements in respect of prime numbers p and q : I. Their LCM is always an odd number. II. Sum of their LCM and HCF is always an even number. Which of the statements given above is/are correct?

(a) I onlyโ€ƒโ€ƒ(b) II onlyโ€ƒโ€ƒ(c) Both I and IIโ€ƒโ€ƒ(d) Neither I nor II

Solution. Test "always" with the prime 2. Take โ€‹p = 2โ€‹ and โ€‹q = 3โ€‹. They are co-prime, so the HCF is 1 and the LCM is 6. Statement I: 6 is even, so I is not correct. Statement II: โ€‹6 + 1 = 7โ€‹ is odd, so II is not correct. Answer (d).

CDS I 2026, Q23. The HCF and LCM of two numbers p and q are 44 and 4620 respectively. When p is divided by 55, the quotient is 4 and remainder is 0. What is the value of q?

(a) 770โ€ƒโ€ƒ(b) 924โ€ƒโ€ƒ(c) 1155โ€ƒโ€ƒ(d) 2310

Solution. First โ€‹p = 55 \times 4 + 0 = 220โ€‹. For two numbers, HCF โ€‹\timesโ€‹ LCM โ€‹=โ€‹ product, so โ€‹220 \times q = 44 \times 4620โ€‹. Cancel before multiplying: โ€‹\dfrac{44}{220} = \dfrac{1}{5}โ€‹, so โ€‹q = \dfrac{4620}{5} = 924โ€‹. Answer (b).

CDS I 2026, Q24. Let N be the greatest number that will divide 600, 631 and 724, leaving the same remainder. What is the value of N?

(a) 41โ€ƒโ€ƒ(b) 37โ€ƒโ€ƒ(c) 33โ€ƒโ€ƒ(d) 31

Solution. Take the HCF of the differences (section 5). They are โ€‹631 - 600 = 31โ€‹, โ€‹724 - 631 = 93โ€‹ and โ€‹724 - 600 = 124โ€‹. Since โ€‹93 = 3 \times 31โ€‹ and โ€‹124 = 4 \times 31โ€‹, the HCF is 31. Each of the three numbers leaves 11 on division by 31. Answer (d).

CDS I 2026, Q79. A Question is given followed by two Statements I and II. Consider the Question and the Statements and mark the correct option.

Question: LCM of three numbers p, q and r โ€‹(p > q > r > 0)โ€‹ is 30 and their HCF is 5. What is the product of the three numbers?

Statement-I: p = 15

Statement-II: q = 10

Which one of the following is correct in respect of the above Question and the Statements?

(a) The Question can be answered by using one of the statements alone, but cannot be answered using the other statement aloneโ€ƒโ€ƒ(b) The Question can be answered by using either Statement aloneโ€ƒโ€ƒ(c) The Question can be answered by using both the Statements together, but cannot be answered using either Statement aloneโ€ƒโ€ƒ(d) The Question can be answered even without using both the Statements

Solution. Each number is a multiple of the HCF 5 and a factor of the LCM 30 (section 1). So each is one of 5, 10, 15, 30. Any three of these four have HCF 5 and LCM 30, and the products differ, so the Question alone does not fix the answer. Statement I: the largest is 15, so the numbers are 15, 10, 5 and the product is 750. Enough. Statement II: the middle one is 10, so the numbers are 30, 10, 5 or 15, 10, 5. The products are 1500 and 750. Not enough. One statement alone answers it and the other does not. Notice that the product rule of section 3 cannot be used here, because there are three numbers. Answer (a).

A question from CDS II 2024 (no official key was published; the answer is our own working)

CDS II 2024, Q3. Let โ€‹Nโ€‹ be a 5-digit number. When โ€‹Nโ€‹ is divided by 6, 12, 15, 24 it leaves respectively 2, 8, 11, 20 as remainders. What is the greatest value of โ€‹Nโ€‹?

(a) 99960โ€ƒโ€ƒ(b) 99956โ€ƒโ€ƒ(c) 99950โ€ƒโ€ƒ(d) 99946

Solution. Each remainder is 4 short of its divisor: โ€‹6 - 2 = 12 - 8 = 15 - 11 = 24 - 20 = 4โ€‹. So โ€‹N = L \times k - 4โ€‹. The LCM of 6, 12, 15 and 24 is 120. The largest 5-digit multiple of 120 is โ€‹120 \times 833 = 99960โ€‹. So โ€‹N = 99960 - 4 = 99956โ€‹. Answer (b).

Option (a) of the last question is the LCM multiple itself. The paper often lists the number you reach one step before the answer.

Mistakes that cost marks

  1. Using HCF โ€‹\timesโ€‹ LCM โ€‹=โ€‹ product for three numbers. It holds for two numbers only. For three, list the possible numbers, as in CDS I 2026 Q79.
  2. Stopping at the LCM. "Leaves remainder 3" means LCM multiple plus 3. "Remainders 2, 8, 11, 20" means LCM multiple minus 4. Do the last step.
  3. Taking the HCF of the numbers when the remainders are equal. For "leaving the same remainder", take the HCF of the differences.
  4. Mixing up lowest and highest powers. HCF: common primes, lowest powers. LCM: all primes, highest powers. A quick test: the HCF must divide each number, and each number must divide the LCM.

Quick check

Do these without help. Answers are at the end.

  1. Find the HCF and the LCM of 36 and 120.
  2. The HCF of two numbers is 15 and their product is 4500. Find their LCM.
  3. Find the least number that leaves remainder 2 when divided by 5, 6 and 8.
  4. Find the greatest number that divides 62 and 90 leaving remainder 6 in each case.
  5. Find the LCM of โ€‹0.6โ€‹, โ€‹1.5โ€‹ and โ€‹2.4โ€‹.

Read and watch more, free

What Where Language
Textbook, HCF and LCM from the start NCERT Class 7 Ganita Prakash Part II, Chapter 3 Finding Common Ground ยท Hindi edition English, Hindi
Textbook, Euclid's algorithm NCERT Class 9 Ganita Manjari Part II, Chapter 11 The World of Algorithms, section 11.2 Greatest Common Divisor (the Hindi edition of this part is not yet published) English
Textbook, HCF and LCM by prime factors NCERT Class 10 Mathematics, Chapter 1 Real Numbers ยท Hindi edition English, Hindi
Lessons with practice Khan Academy: NCERT Math Class 10 (the unit on real numbers) ยท in Hindi English, Hindi
Practice with answers NCERT Exemplar Class 10, Unit 1 Real Numbers ยท Hindi edition English, Hindi
The real papers UPSC previous question papers English, Hindi
Video, a full CDS course R.S SIR: Maths Playlist for CDS 2025 (the LCM and HCF lessons, about 55 minutes each) Hindi and Hinglish
Video, in Hindi Rojgar with Ankit Defence: CDS 01 2025, Maths By Neeraj Baisla Sir (the eight LCM and HCF lessons) Hindi
Video, one lesson with past questions The Journey Extraordinary: Maths For CDS 2 2026 (the LCM and HCF lesson) Hinglish

The videos were chosen from their titles, length and views; they have not yet been watched by a teacher.

Answers to the quick check

  1. โ€‹36 = 2^2 \times 3^2โ€‹ and โ€‹120 = 2^3 \times 3 \times 5โ€‹. HCF โ€‹= 2^2 \times 3 = 12โ€‹; LCM โ€‹= 2^3 \times 3^2 \times 5 = 360โ€‹.
  2. LCM โ€‹= \dfrac{4500}{15} = 300โ€‹.
  3. The LCM of 5, 6 and 8 is 120, so the number is โ€‹120 + 2 = 122โ€‹.
  4. Take away the remainder: 56 and 84. Their HCF is 28.
  5. Work with 6, 15 and 24. Their LCM is 120, so the answer is โ€‹12.0 = 12โ€‹.

Next chapter: Logarithms to base 10.

Free ยท no sign-up

Try three questions on this chapter

Exam-pattern questions from this chapter's drill. Pick an answer for each, then check.

  1. Question 1 of 3
    Consider the following statements: I. The HCF of two different natural numbers is always smaller than each of the two numbers. II. The LCM of two different natural numbers is always greater than each of the two numbers. Which of the statements given above is/are correct?
  2. Question 2 of 3
    What is the HCF of 2923 and 3239?
  3. Question 3 of 3
    What is the LCM of โ€‹\tfrac{9}{10}โ€‹, โ€‹\tfrac{12}{25}โ€‹ and โ€‹\tfrac{18}{35}โ€‹?
Free sign-up

You have read the chapter. Now make it stick.

A free account adds the video lesson, a drill of ten questions on this chapter marked like the exam, the timed mock papers, a study plan to your exam date and your own record of what you have done. No fee, no card.

Past questions quoted are from the official UPSC paper named in the text; the working is WishWas's own, checked against UPSC's answer key where one has been published. The links under โ€œRead and watch moreโ€ go to free material on other sites; nothing is copied.