IGKO is TODAY!
Mock Test ₹150 View Schedule

Ganita Manjari · Class 9 · Part II · Chapter 11

Ganita Manjari Class 9 Maths Chapter 11 The World of Algorithms End-of-Chapter Exercises Solutions

All 5 end-of-chapter questions: four gcd computations, a proof, and algorithms for primes, prime divisors and prime factorisation.

Last updated 6 October 2026

  • 5Questions
  • 1Diagrams
  • Ch 11The World of Algorithms

How to answer every question

  1. Follow the rule exactly Write each step so that a reader can do it without guessing.
  2. Name the lists Give each list or number a name and say what starts empty.
  3. Execute on a small case Run the algorithm on a small example and write what happens.
  4. Justify and count Say why the algorithm is correct and how many steps it needs.

Remainder (m mod n): what is left when m is divided by n.

Prime number: a number with exactly two divisors, 1 and itself.

Prime factorisation: writing a number as a product of primes, such as 22 × 32 × 51.

Euclid's algorithm

Chapter 11 End-of-Chapter Exercises Question 1 Solution : Compute (i) gcd(375, 825), (ii) gcd(51000, 81000), (iii) gcd(1789287, 237656), (iv) gcd(2587392, 157656) by the improved version of Euclid's algorithm.

Answer: 75, 3000, 1, 24

The rule: if m < n, reverse them. If n = 0, the answer is m. Otherwise replace gcd(m, n) by gcd(n, m mod n), where m mod n is the remainder when m is divided by n.

Part (i) · gcd(375, 825)75

The book carries out this algorithm in the long-division layout of Āryabhaṭa. Its Example 2 is exactly gcd(825, 375): 825 divided by 375 gives quotient 2 and remainder 75, and then 375 divided by 75 gives remainder 0, so the gcd is 75.

The book's three long-division examples. Example 2 shows gcd(825, 375) reduced to gcd(375, 75), with 375 divided by 75 leaving remainder 0, so the gcd is 75.
Q1 · the book's long-division examples; Example 2 is gcd(825, 375) (from the book)
StepProblemDivision m = q × n + rNext
1gcd(375, 825)m < n, so reverse→ gcd(825, 375)
2gcd(825, 375)825 = 2 × 375 + 75gcd(375, 75)
3gcd(375, 75)375 = 5 × 75 + 0n = 0, answer 75
Tiles for gcd(375, 825)825 is two blocks of 375 plus a block of 75; 375 is five blocks of 75; the gcd is 75.Q1(i) · 825 = 2 × 375 + 75 and 375 = 5 × 75375375758257575757575375the remainder 75 tiles 375 exactly, so 75 is the largest block that tiles both
Q1(i) · 825 = 2 × 375 + 75 and 375 = 5 × 75, so the last block size 75 is the gcd
Part (ii) · gcd(51000, 81000)3000
StepProblemDivision m = q × n + rNext
1gcd(51000, 81000)m < n, so reverse→ gcd(81000, 51000)
2gcd(81000, 51000)81000 = 1 × 51000 + 30000gcd(51000, 30000)
3gcd(51000, 30000)51000 = 1 × 30000 + 21000gcd(30000, 21000)
4gcd(30000, 21000)30000 = 1 × 21000 + 9000gcd(21000, 9000)
5gcd(21000, 9000)21000 = 2 × 9000 + 3000gcd(9000, 3000)
6gcd(9000, 3000)9000 = 3 × 3000 + 0n = 0, answer 3000

The last non-zero remainder is 3000. Check: 51000 = 17 × 3000 and 81000 = 27 × 3000, and 17 and 27 have no common factor.

Part (iii) · gcd(1789287, 237656)1
StepProblemDivision m = q × n + rNext
1gcd(1789287, 237656)1789287 = 7 × 237656 + 125695gcd(237656, 125695)
2gcd(237656, 125695)237656 = 1 × 125695 + 111961gcd(125695, 111961)
3gcd(125695, 111961)125695 = 1 × 111961 + 13734gcd(111961, 13734)
4gcd(111961, 13734)111961 = 8 × 13734 + 2089gcd(13734, 2089)
5gcd(13734, 2089)13734 = 6 × 2089 + 1200gcd(2089, 1200)
6gcd(2089, 1200)2089 = 1 × 1200 + 889gcd(1200, 889)
7gcd(1200, 889)1200 = 1 × 889 + 311gcd(889, 311)
8gcd(889, 311)889 = 2 × 311 + 267gcd(311, 267)
9gcd(311, 267)311 = 1 × 267 + 44gcd(267, 44)
10gcd(267, 44)267 = 6 × 44 + 3gcd(44, 3)
11gcd(44, 3)44 = 14 × 3 + 2gcd(3, 2)
12gcd(3, 2)3 = 1 × 2 + 1gcd(2, 1)
13gcd(2, 1)2 = 2 × 1 + 0n = 0, answer 1

The remainders shrink 125695, 111961, 13734, 2089, 1200, 889, 311, 267, 44, 3, 2, 1, 0. The last non-zero remainder is 1, so the two numbers have no common factor other than 1 (they are co-prime).

Part (iv) · gcd(2587392, 157656)24
StepProblemDivision m = q × n + rNext
1gcd(2587392, 157656)2587392 = 16 × 157656 + 64896gcd(157656, 64896)
2gcd(157656, 64896)157656 = 2 × 64896 + 27864gcd(64896, 27864)
3gcd(64896, 27864)64896 = 2 × 27864 + 9168gcd(27864, 9168)
4gcd(27864, 9168)27864 = 3 × 9168 + 360gcd(9168, 360)
5gcd(9168, 360)9168 = 25 × 360 + 168gcd(360, 168)
6gcd(360, 168)360 = 2 × 168 + 24gcd(168, 24)
7gcd(168, 24)168 = 7 × 24 + 0n = 0, answer 24

The last non-zero remainder is 24. Check: 2587392 = 107808 × 24 and 157656 = 6569 × 24.

(i) 75, (ii) 3000, (iii) 1, (iv) 24. Even for 7-digit numbers, the division version needed only 13 steps at most.

Chapter 11 End-of-Chapter Exercises Question 2 Solution : Assume m ≥ n. Verify that d divides both m and n if and only if d divides both n and m mod n.

Answer: proved both ways
Setting up

Divide m by n: m = q × n + r, where q is the quotient and r = m mod n is the remainder, with 0 ≤ r < n. So r = m − q × n.

The picture behind the idea

The book's Fig. 11.1 shows the same idea for subtraction: if blocks of size d tile both m and n, they also tile m − n. Taking away n again and again from m leaves m mod n, so the picture works for the remainder too.

Two rows of blocks of size d. The top row has length m. The bottom row is split into a part of length n and a part of length m minus n, and both parts are tiled by blocks of size d.
Q2 · Fig. 11.1 of the book: blocks of size d tile m, n and m − n (from the book)
Step 1 · If d divides m and n, then d divides n and r

Write m = ad and n = bd. Then r = m − qn = ad − q(bd) = (a − qb)d. So d divides r, and d also divides n. Therefore d divides both n and m mod n.

Step 2 · If d divides n and r, then d divides m and n

Write n = xd and r = yd. Then m = qn + r = q(xd) + yd = (qx + y)d. So d divides m, and d also divides n. Therefore d divides both m and n.

A numerical check

Take m = 825 and n = 375. Then r = 825 mod 375 = 75, since 825 = 2 × 375 + 75.

dDivides 825 and 375?Divides 375 and 75?
25yesyes
75yesyes
11no (11 does not divide 375)no (11 does not divide 75)
125no (125 does not divide 825)no (125 does not divide 75)

The common divisors of m and n are exactly the common divisors of n and m mod n, so gcd(m, n) = gcd(n, m mod n), which justifies the improved algorithm. (Proving both directions is the idea of an "if and only if" statement; see Chapter 9 Propositions and their Converses Solutions.)

Primes

Chapter 11 End-of-Chapter Exercises Question 3 Solution : Write an algorithm prime(n) to check if n is prime. (Hint: a prime p has exactly two divisors, 1 and p. Use divisors(n).)

Answer: prime when divisors(n) has 2 elements
Algorithm prime(n)
  1. Let list-of-divisors be the list obtained by computing divisors(n).
  2. If list-of-divisors has exactly two elements, report "n is prime".
  3. Otherwise report "n is not prime".
Execute it on examples
ndivisors(n)ElementsResult
13[1, 13]2prime
15[1, 3, 5, 15]4not prime
2[1, 2]2prime
1[1]1not prime

n = 1 has only one divisor, so it is not prime, and the algorithm correctly says so.

A quicker version

We can stop early. If any j from 2 to n − 1 divides n, report "not prime" and stop. If none does, report "prime" (for n larger than 1).

prime(n): compute divisors(n); if it has exactly two elements (1 and n), n is prime, otherwise it is not.

Chapter 11 End-of-Chapter Exercises Question 4 Solution : Write an algorithm primedivisors(n) to compute the list of divisors of n that are prime numbers. (Hint: compute divisors(n) and filter out the primes.)

StarredAnswer: filter divisors(n) with prime
Algorithm primedivisors(n)
  1. Let divisors-of-n be the list obtained by computing divisors(n).
  2. Start with an empty list prime-divisors.
  3. For each d in divisors-of-n: if prime(d) says d is prime, add d to prime-divisors.
  4. Report prime-divisors.
Execute it for n = 180

divisors(180) = [1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 30, 36, 45, 60, 90, 180]. Test each one with prime(d).

dNumber of divisors of dPrime?
11no
22yes
32yes
43no
52yes
64no
93no
104no
126no
154no
186no
206no
308no
369no
456no
6012no
9012no
18018no

Only 2, 3 and 5 have exactly two divisors.

primedivisors(180) = [2, 3, 5]. The algorithm lists divisors(n) and keeps those d for which prime(d) is true.

Chapter 11 End-of-Chapter Exercises Question 5 Solution : Write an algorithm to compute the prime factorisation of a number. (i) The prime factorisation of 180 is 22 × 32 × 51. How would you represent this? (ii) How would you compare the prime factorisations of two numbers?

StarredAnswer: list of (prime, exponent) pairs
The algorithm
  1. Start with an empty list factors. Let r = n and p = 2.
  2. As long as r is bigger than 1: if p divides r, add p to factors and replace r by rp. Otherwise, add 1 to p.
  3. Report factors.
Execute it for n = 180
rpDoes p divide r?factorsNew r
1802yes[2]90
902yes[2, 2]45
452no[2, 2]45 (p becomes 3)
453yes[2, 2, 3]15
153yes[2, 2, 3, 3]5
53no[2, 2, 3, 3]5 (p becomes 4)
54no[2, 2, 3, 3]5 (p becomes 5)
55yes[2, 2, 3, 3, 5]1

r has become 1, so we stop. The composite 4 never divides r, because all the 2s were already removed. So p only ever stops at primes.

Part (i) · How to represent 180 = 22 × 32 × 51

Write a list of pairs (prime, exponent), in increasing order of the prime.

180 → [(2, 2), (3, 2), (5, 1)]

Count equal entries of factors: 2 appears twice, 3 twice, 5 once.

Part (ii) · Comparing two factorisations to get the gcd

Go through both lists. For every prime that appears in both, keep the smaller exponent. Multiply these powers to get the gcd.

NumbersFactorisationsCommon primes with smaller exponentgcd
375 and 825375 → [(3, 1), (5, 3)]; 825 → [(3, 1), (5, 2), (11, 1)]31 and 523 × 25 = 75
180 and 150180 → [(2, 2), (3, 2), (5, 1)]; 150 → [(2, 1), (3, 1), (5, 2)]21, 31 and 512 × 3 × 5 = 30

Both answers agree with Euclid's algorithm. A prime that appears in only one number (like 11 above) does not go into the gcd.

Factorise by trying p = 2, 3, 4, … and dividing out. Store 180 as [(2, 2), (3, 2), (5, 1)]. For the gcd, multiply each common prime to its smaller exponent.

Answers at a glance

The gcd questions use the improved Euclid algorithm; the others build algorithms from earlier ones.

QuestionWhat is askedKey ideaAnswer
Q1 Four gcdsRepeat gcd(n, m mod n)75, 3000, 1, 24
Q2 Verify the divisor claimm = q × n + rProved both ways
Q3 Is n prime?divisors(n) has 2 elementsprime(n) algorithm
Q4 Prime divisors of nFilter divisors with prime[2, 3, 5] for 180
Q5 Prime factorisationDivide out p = 2, 3, …[(2, 2), (3, 2), (5, 1)]; gcd by min exponents

Source of the questions: NCERT, Ganita Manjari, Grade 9, Part II, Chapter 11, End-of-Chapter Exercises. The solutions, explanations and diagrams on this page are our own working.

Call WhatsApp Book Demo