I\'m doing the exercises to TAOCP Volume 1 Edition 3 and have trouble understanding the syntax used in the answer to the following exercise.
Chapter 1 Exercise 8
The superscript for gcd(m,n) is due to how numbers are being represented in this table.
For example: m => a^m n => b^n
gcd(m,n) => a^gcd(m,n)
It looks to be like Euclids algorithm is being implemented. i.e.
gcd(m,n):
if n==0:
return m
return gcd(n,m%n)
The numbers are represented as powers so as to be able to do the modulo operation m%n.
For example, 4 % 3, will be computed as follows: 4 'a's (a^4) mod 3 'b's (b^3), which will leave 1 'a' (a^1).