Āryabhaṭa's algorithm
Āryabhaṭa's division algorithm
One change
Change just one step of Euclid's algorithm: reduce gcd(m, n) to gcd(n, m mod n) instead of gcd(n, m − n). The stopping rule stays the same.
The book works out gcd(60, 16).
60 mod 16 is …
What this lesson covers
The idea
Euclid's algorithm with the third step changed to reduce gcd(m, n) to gcd(n, m mod n), keeping the same stopping condition.
One change
Change just one step of Euclid's algorithm: reduce gcd(m, n) to gcd(n, m mod n) instead of gcd(n, m − n). The stopping rule stays the same. The book works out gcd(60, 16).
60 mod 16 is …
- 12
- 3
- 44
Run it for 60 and 16
Division algorithm for gcd(m, n) 1. If m < n, reverse the numbers and compute gcd(n, m). 2. If n = 0, report the answer as m. 3. Otherwise, reduce the problem to computing gcd(n, m mod n). Run it for gcd(60, 16).
Divide, then divide again
Āryabhaṭa's division algorithm is Euclid's algorithm with Step 3 changed to reduce gcd(m, n) to gcd(n, m mod n), keeping the same stopping condition.
gcd(60, 16) = gcd(16, 12) = gcd(12, 4) = gcd(4, 0) = 4. As long division, the way Indians did it at least from the time of Āryabhaṭa: 16 ) 60 ( 3, remainder 12; 12 ) 16 ( 1, remainder 4; 4 ) 12 ( 3, remainder 0. The last divisor, 4, is the gcd. The book also does gcd(825, 375): 375 ) 825 ( 2, remainder 75; 75 ) 375 ( 5, remainder 0, so gcd = 75.
Notes
Division algorithm: if m < n, swap; if n = 0, report m; otherwise reduce to gcd(n, m mod n). In long division, the last divisor is the gcd.
Check yourself
Which step of Euclid's algorithm changes?
Use the division algorithm: gcd(825, 375) = ?
Answer: 75
gcd(825, 375) = gcd(375, 75) = gcd(75, 0) = 75.
In the long division for gcd(60, 16), the last divisor is the gcd. What is it?
Answer: 4
The last divisor, with remainder 0, is 4.
- Only Step 3: gcd(n, m − n) becomes gcd(n, m mod n) — correct. Yes. The swap and the stopping rule stay the same.
- Step 2: the stopping rule. We still stop when n = 0.
- All three steps. Only the reduction changes.