Prepared for PYQ Hub. Spotted a mistake? Tell us and we will fix it.

11.1 Adding Numbers

Column addition shows how a clearly described set of steps can solve a problem much faster than counting objects.

Key idea: An algorithm is a precise, repeatable set of steps. In column addition, we place units under units, tens under tens, and carry to the next place when needed.
Exercise 11.1 · Question 1 (Page 38)

Add any two 4-digit numbers by following the textbook algorithm exactly. Does it always produce the correct answer?

Solution

Worked example: Add 3487 and 2756.

Units: 7 + 6 = 13 → write 3, carry 1.
Tens: 8 + 5 + 1 = 14 → write 4, carry 1.
Hundreds: 4 + 7 + 1 = 12 → write 2, carry 1.
Thousands: 3 + 2 + 1 = 6 → write 6, carry 0.
3487 + 2756 = 6243

For this pair, the algorithm works. But it does not always work exactly as written. The textbook gives branches for a sum less than 10 and a sum more than 10; it leaves out a sum equal to 10. For instance, in 1234 + 5676, the units total is 4 + 6 = 10, and neither instruction applies.

Fix: Replace “more than 10” with “10 or more” (or “≥ 10”) wherever a carry is determined. Then 1234 + 5676 = 6910.

This is a wording gap in the textbook chapter, not an extra rule that should be silently assumed when the question says to follow the steps precisely.
1 1 1 7 8 4 3 6 5 7 2 + 3 4 2 6 carry 1 written above each column 1 1 1 1 8 8 8 8 8 8 8 8 + 6 7 7 7 1 Step 5 writes the final carry 1 Red: carries. Orange: the final carry that Step 5 puts on the left
Left: 3487 + 2756 with its carries. Right: 8888 + 8888, where the final carry needs Step 5 (see Q5).
Exercise 11.1 · Question 2 (Page 38)

What happens when a 5-digit number is added to a 3-digit number? Do the original steps handle this case correctly?

Solution

Not fully. The original instructions say to align the rightmost digits but do not explicitly explain what to do when one number has fewer digits.

For example, write 12,345 + 678 as:

 12345
+00678
------
 13023

We treat the absent left-hand digits of 678 as zeros. We must also correct the rule for column sums equal to 10. After both clarifications, 12,345 + 678 = 13,023.

Exercise 11.1 · Question 3 (Page 38)

Why should the columns be aligned from right to left?

Solution

Because digits have different place values. The rightmost positions are units, then tens, hundreds, and so on. Aligning from the right means we add quantities of the same place value: units with units, tens with tens, etc.

If we line up the leftmost digits of numbers with different lengths, a hundreds digit could be incorrectly added to a tens digit.

Exercise 11.1 · Question 4 (Page 38)

Why can the carry in Step 3 never be greater than 1?

Solution

The largest single digit is 9, and the incoming carry is at most 1. Therefore the greatest possible total for a column is:

9+9+1=19

Since 19 contains only one ten, at most 1 needs to be carried to the next column. No column can generate a carry of 2 when adding only two numbers.

Exercise 11.1 · Question 5 (Page 38)

What happens if the fifth step (writing the final carry at the left) is omitted? Show a case where it works and one where it fails.

Solution

Case where it works: 1234 + 4321 = 5555. There is no final carry after the thousands column, so skipping Step 5 causes no problem.

Case where it fails: 8888 + 8888 = 17,776. The column operations leave a final carry of 1. Without Step 5, we would write just 7776, which is wrong.

Conclusion: The final step is necessary whenever the leftmost column produces a carry.

Think and Reflect 1 (Page 39)

Explain why grouping numbers into units, tens, hundreds, etc., proves the usual addition algorithm is correct.

Solution

Every number can be broken into place-value groups. For example, 248 = 200 + 40 + 8 and 176 = 100 + 70 + 6.

Units: 8 + 6 = 14 = 1 ten + 4 units.
Tens: 4 tens + 7 tens + 1 ten = 12 tens = 1 hundred + 2 tens.
Hundreds: 2 hundreds + 1 hundred + 1 hundred = 4 hundreds.
So 248 + 176 = 424.

At each place, we preserve the total value by exchanging 10 units for 1 ten, or 10 tens for 1 hundred. This is why carrying does not change the sum, and the column method is correct.

Think and Reflect 2 (Page 39)

How should the algorithm be modified to add two decimal fractions?

Solution
  1. Align the decimal points, so equal place values line up.
  2. Add trailing zeros where helpful (for example, 2.5 = 2.50).
  3. Add each column from the right, carrying whenever a column total is 10 or more.
  4. Put the decimal point in the answer directly below the aligned decimal points.
Example: 12.35 + 4.70 = 17.05.
Hundredths: 5 + 0 = 5; tenths: 3 + 7 = 10 → write 0, carry 1.
Units: 2 + 4 + 1 = 7; tens: 1 + 0 = 1.

11.2 Greatest Common Divisor (GCD / HCF)

Understand the original divisor-list algorithm before looking at the faster methods.

Key idea: A divisor of n is a positive integer that divides n exactly. The greatest common divisor (GCD), also called the HCF, is the largest divisor shared by both numbers.
Example from the chapter: Divisors of 375 = [1, 3, 5, 15, 25, 75, 125, 375]. Divisors of 825 = [1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825]. Their largest common divisor is 75.
Think and Reflect Think and Reflect (Page 41)

Execute the divisor-finding algorithm for 15, 135, and 775. How does the amount of work grow as the numbers increase?

Solution
NumberComplete list of divisorsCount
151, 3, 5, 154
1351, 3, 5, 9, 15, 27, 45, 1358
7751, 5, 25, 31, 155, 7756

The textbook's basic method tests every integer from 1 through n. Therefore it makes 15, 135, and 775 divisibility checks, respectively. Although 775 has fewer actual divisors than 135, the basic algorithm still makes many more checks because it examines all candidate numbers.

How the first GCD algorithm works

  1. Find all divisors of m in increasing order.
  2. Find all divisors of n in increasing order.
  3. Keep only the divisors present in both lists.
  4. Because the common-divisor list is increasing, its last element is the GCD.

For 54,000 and 81,000, the chapter finds GCD = 27,000. Later sections improve this method so that we do not have to test thousands of candidates.

11.3 Data Structures and Exercise Set 11.2

Learn how to compare ordered lists, compute LCM, and use factor pairs to speed up divisor searches.

Key idea: Lists are data structures. They store values in an order that an algorithm can use. The original GCD solution relies on sorted divisor lists.
Exercise 11.2 · Question 1 (i) (Page 43)

Given two lists of numbers in increasing order, write an algorithm to find values that occur in List 1 but do not occur in List 2.

Solution

Start with an empty result list. For every number x in List 1, check if x occurs in List 2. If it does not, append x to the result.

only_in_1 = []
for each x in List1:
    if x is not in List2:
        append x to only_in_1
report only_in_1

Example: List 1 = [1, 3, 5, 7] and List 2 = [3, 4, 7]. Answer = [1, 5].

Exercise 11.2 · Question 1 (ii) (Page 43)

Write an algorithm to find values that occur in List 2 but do not occur in List 1.

Solution

This is the same procedure with the roles reversed:

only_in_2 = []
for each y in List2:
    if y is not in List1:
        append y to only_in_2
report only_in_2

Example: For the same two lists, the answer is [4].

Efficiency tip: Because both lists are sorted, a two-pointer scan can compare the smallest remaining elements and move forward without repeatedly searching the entire other list. This is an optional improvement, not required to understand the original algorithm.

Exercise 11.2 · Question 2 (Page 43)

Describe an algorithm to calculate the least common multiple (LCM) of two positive integers.

Solution

The LCM is the smallest positive number divisible by both inputs. One direct algorithm checks multiples in ascending order:

step = max(m, n)
candidate = step
while candidate is not divisible by min(m, n):
    candidate = candidate + step
report candidate

Example: For 12 and 18, test multiples of 18: 18 is not divisible by 12, but 36 is. The first positive integer divisible by both is 36, so LCM(12, 18) = 36.

Faster method: Once we know the GCD, use LCM(m, n) = (m ÷ GCD(m, n)) × n. Here, GCD(12, 18) = 6 and (12 ÷ 6) × 18 = 36.

Exercise 11.2 · Question 3 (i) (Page 44) ★

Divisors come in pairs, such as (1,18), (2,9), and (3,6) for 18. How many candidate values do we need to examine to find every divisor of n?

Solution

We only need to check 1, 2, …, ⌊√n⌋ (all positive integers up to the square root of n).

If j divides n, then n ÷ j is also a divisor. At least one number in each factor pair is ≤ √n.

Example: For 36, check j = 1, 2, 3, 4, 5, 6 (just 6 checks instead of 36). The pairs found are (1,36), (2,18), (3,12), (4,9), and (6,6). When both elements of a pair are equal, include the divisor only once.

1 2 3 4 6 9 12 18 36 √36 = 6 divisors found by testing 1–6 found as partners
Each divisor of 36 pairs with another; one of each pair is at most √36 = 6.
Exercise 11.2 · Question 3 (ii) (Page 44) ★

If divisors are generated in pairs, will the original GCD algorithm still work exactly as described?

Solution

Not necessarily. The original algorithm assumes the divisor lists are in increasing order, then takes the rightmost common divisor as the largest. Pair-generation does not automatically preserve that order.

Counterexample: Pair-order divisors of 36 can be [1, 36, 2, 18, 3, 12, 4, 9, 6]. Comparing with divisors of 24 gives common values in this order: [1, 2, 3, 12, 4, 6]. The final value is 6, but the true GCD(36, 24) is 12.

Fix: Sort the divisors into ascending order before using the original algorithm, or track the maximum common divisor rather than taking the last one.

11.3.1 Improving the Algorithm and Exercise Set 11.3

Changes in ordering affect whether we must use the first, last, or greatest element.

Improving the GCD search

  1. The original algorithm tests m + n candidate divisors to build two lists.
  2. Combining the scans reduces the range to max(m, n).
  3. Checking only possible common divisors reduces it to min(m, n).
  4. Storing only the latest (and therefore largest so far) common divisor removes the need for a list.
latest = 1
for k from 2 to min(m, n):
    if k divides m and k divides n:
        latest = k
report latest
Exercise 11.3 · Question 1 (Page 45)

If the divisor-finding algorithm checks n, n−1, …, 1 instead of 1, 2, …, n, how must the original GCD algorithm be changed?

Solution

Each divisor list will now be in decreasing order, not increasing order. Therefore the common-divisor list will also be decreasing.

We must report its first (leftmost) element, rather than its last element.

Example: For 12 and 18, the common-divisor list in descending order is [6, 3, 2, 1]. The first element gives the correct GCD, 6; the last would incorrectly give 1.

Exercise 11.3 · Question 2 (Page 45)

What changes if the improved algorithm that keeps no list scans possible common divisors backward, from min(m, n) down to 1?

Solution

We can stop at the first number that divides both inputs. Since we are searching from largest to smallest, the first common divisor encountered must be the GCD.

for k from min(m, n) down to 1:
    if k divides m and k divides n:
        report k
        stop

Example: For 12 and 18, test 12, 11, 10, 9, 8, 7, then 6. The first common divisor is 6, so the algorithm stops.

11.3.2–11.3.4 Euclid and Āryabhaṭa: The Fast GCD Methods

The faster method keeps the same mathematical answer while replacing many subtractions with a single division.

Euclid’s subtraction algorithm

For m ≥ n, replace (m, n) with (n, m−n), reordering if necessary. If one entry reaches zero, the other is the GCD.

gcd_subtract(m, n):
    while m != 0 and n != 0:
        if m > n: m = m - n
        else:     n = n - m
    return m if n == 0 else n

Āryabhaṭa’s division algorithm

Replace repeated subtraction with the remainder operation. This is the much faster algorithm used in the chapter's final exercise.

Start with (m, n) m < n ? swap m and n n = 0 ? gcd = m. Stop (m, n) → (n, m mod n) yes no yes no repeat
The division algorithm as a flowchart: swap if needed, stop when n = 0, otherwise replace (m, n) by (n, m mod n).
gcd_divide(m, n):
    while n != 0:
        remainder = m mod n
        m = n
        n = remainder
    return m
Why division is faster: GCD(99, 2) takes 51 subtraction reductions when we continue until one entry is zero but only two remainder reductions: 99 mod 2 = 1; 2 mod 1 = 0. So GCD = 1.
In-text proof (Page 46)

Why does GCD(m, n) = GCD(n, m−n) when m ≥ n?

Solution

If d divides both m and n, then d also divides their difference m−n.

Conversely, if d divides both n and m−n, it must divide their sum n + (m−n) = m.

Thus the two number-pairs have exactly the same common divisors and consequently the same GCD.

d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d m n m − n If d tiles m and n exactly, it also tiles m − n (and the other way round)
Fig. 11.1 idea: blocks of size d that fit m and n exactly also fit m − n.
In-text check (Page 48)

Show why every odd number 2k+1 has GCD 1 with 2 using the division algorithm.

Solution

Every odd number can be written as 2k + 1. Dividing it by 2 leaves remainder 1.

GCD(2k + 1, 2) = GCD(2, 1)
GCD(2, 1) = GCD(1, 0) = 1

two remainder reductions suffice when the odd number is at least 3. For the odd number 1, starting with the larger input gives 2 mod 1 = 0 in one step.

End-of-Chapter Exercises

Complete step-by-step solutions to the textbook’s closing questions.

These are the chapter's final textbook questions, including all four large GCD calculations.

End-of-Chapter · Question 1 (i) (Page 50)

Compute GCD(375, 825) using the improved (division/remainder) algorithm.

Solution

Use larger number = smaller number × quotient + remainder, then repeat with the smaller number and the remainder:

825 = 375 × 2 + 75
375 = 75 × 5 + 0

The last nonzero remainder is 75, so GCD(375, 825) = 75.

(i) gcd(375, 825) 375 825 (2) − 750 75 75 375 (5) − 375 0 Last divisor = gcd = 75 (ii) gcd(51000, 81000) 51,000 81,000 (1) − 51,000 30,000 30,000 51,000 (1) − 30,000 21,000 21,000 30,000 (1) − 21,000 9,000 9,000 21,000 (2) − 18,000 3,000 3,000 9,000 (3) − 9,000 0 Last divisor = gcd = 3,000
Āryabhaṭa's long-division layout for Q1 (i) and (ii): the last divisor (remainder 0 below it) is the gcd.
End-of-Chapter · Question 1 (ii) (Page 50)

Compute GCD(51,000, 81,000) using the improved (division/remainder) algorithm.

Solution

Use larger number = smaller number × quotient + remainder, then repeat with the smaller number and the remainder:

81,000 = 51,000 × 1 + 30,000
51,000 = 30,000 × 1 + 21,000
30,000 = 21,000 × 1 + 9,000
21,000 = 9,000 × 2 + 3,000
9,000 = 3,000 × 3 + 0

The last nonzero remainder is 3,000, so GCD(51,000, 81,000) = 3,000.

End-of-Chapter · Question 1 (iii) (Page 50)

Compute GCD(1,789,287, 237,656) using the improved (division/remainder) algorithm.

Solution

Use larger number = smaller number × quotient + remainder, then repeat with the smaller number and the remainder:

1,789,287 = 237,656 × 7 + 125,695
237,656 = 125,695 × 1 + 111,961
125,695 = 111,961 × 1 + 13,734
111,961 = 13,734 × 8 + 2,089
13,734 = 2,089 × 6 + 1,200
2,089 = 1,200 × 1 + 889
1,200 = 889 × 1 + 311
889 = 311 × 2 + 267
311 = 267 × 1 + 44
267 = 44 × 6 + 3
44 = 3 × 14 + 2
3 = 2 × 1 + 1
2 = 1 × 2 + 0

The last nonzero remainder is 1, so GCD(1,789,287, 237,656) = 1.

End-of-Chapter · Question 1 (iv) (Page 50)

Compute GCD(2,587,392, 157,656) using the improved (division/remainder) algorithm.

Solution

Use larger number = smaller number × quotient + remainder, then repeat with the smaller number and the remainder:

2,587,392 = 157,656 × 16 + 64,896
157,656 = 64,896 × 2 + 27,864
64,896 = 27,864 × 2 + 9,168
27,864 = 9,168 × 3 + 360
9,168 = 360 × 25 + 168
360 = 168 × 2 + 24
168 = 24 × 7 + 0

The last nonzero remainder is 24, so GCD(2,587,392, 157,656) = 24.

End-of-Chapter · Question 2 (Page 50)

Assuming m ≥ n > 0 and d is a positive integer, prove that d divides both m and n if and only if d divides both n and m mod n.

Solution

By the division algorithm, we can write m = qn + r, where r = m mod n and 0 ≤ r < n.

  1. Forward direction: If d divides m and n, then it divides m − qn = r. So d divides n and r.
  2. Reverse direction: If d divides n and r, then it divides qn + r = m. So d divides m and n.

Therefore the common divisors of (m, n) and (n, m mod n) are identical. GCD(m, n) = GCD(n, m mod n).

End-of-Chapter · Question 3 (Page 50)

Write an algorithm prime(n) to check whether n is prime. Use the earlier divisors(n) algorithm.

Solution

A prime number has exactly two distinct positive divisors, 1 and itself. The number 1 is not prime.

prime(n):
    if n <= 1:
        return False
    D = divisors(n)
    if length(D) == 2:
        return True
    else:
        return False

Example: divisors(13) = [1, 13], so prime(13) is True. But divisors(12) = [1, 2, 3, 4, 6, 12], so prime(12) is False.

Optional speed improvement: Check possible divisors only from 2 up to ⌊√n⌋. If any divides n, the number is not prime; otherwise a number greater than 1 is prime.

End-of-Chapter · Question 4 (Page 50) ★

Write an algorithm primedivisors(n) that returns the divisors of n that are prime.

Solution

First find all divisors, then keep only those for which prime(d) returns True.

primedivisors(n):
    result = []
    D = divisors(n)
    for each d in D:
        if prime(d):
            append d to result
    return result

Example: Divisors of 180 are [1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 30, 36, 45, 60, 90, 180]. The prime divisors are [2, 3, 5].

Note that 1 is excluded, because it is not prime.

End-of-Chapter · Question 5 (Page 50) ★

Write an algorithm to find the prime factorisation of a natural number n.

Solution

Start with the smallest possible prime factor, 2. Divide by that factor repeatedly and record the number of times it divides. Then move to the next possible factor.

prime_factorisation(n):
    factors = []
    p = 2
    while p * p <= n:
        exponent = 0
        while n mod p == 0:
            n = n / p
            exponent = exponent + 1
        if exponent > 0:
            append (p, exponent) to factors
        p = p + 1
    if n > 1:
        append (n, 1) to factors
    return factors

Why this works: We repeatedly divide out the smallest remaining factor. If a number p greater than 2 is composite, its smaller factors would already have been removed; therefore a successful new factor is prime. If the leftover n > 1 after testing up to its square root, it is itself prime.

End-of-Chapter · Question 5 (i) (Page 50) ★

How can the prime factorisation 180 = 2² × 3² × 5¹ be represented?

Solution

Store a list of (prime, exponent) pairs:

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

This means that 2 is multiplied twice, 3 is multiplied twice, and 5 is multiplied once: 4 × 9 × 5 = 180.

End-of-Chapter · Question 5 (ii) (Page 50) ★

How should we compare the prime factorisations of two numbers?

Solution

Match the prime bases. For the GCD, choose the smaller exponent of each prime shared by both numbers. For the LCM, choose the larger exponent of each prime appearing in either factorisation (using exponent 0 if a prime is absent).

180 = 2² × 3² × 5¹
84 = 2² × 3¹ × 7¹
GCD = 2² × 3¹ = 12
LCM = 2² × 3² × 5¹ × 7¹ = 1260

With the pair-list representation, compare the matching prime entries and select the exponent according to the operation.

Chapter Summary

Six short definitions that help connect the main ideas in the PDF.

  • Algorithm: A definite sequence of steps for solving a problem. Its correctness should be justified.
  • Condition: Run an action only if a test holds, such as “if k divides both numbers”.
  • Loop: Repeat an action over a specified range or until a stopping condition holds.
  • Data structure: An organised way to store information, such as an ordered list.
  • Efficiency: Compare how many steps different correct algorithms need.
  • Remainder / mod: The number left after division, such as 17 mod 5 = 2.
Two important reading notes:
  • In the addition steps on pages 37–38, “more than 10” should include exactly 10.
  • The correct remainder identity on page 48 is GCD(m, n) = GCD(n, m mod n); retain n alongside the remainder.
All Ganita Manjari chapters
↑