Exercise 1.20
This problem requires us to study the GCD function in the book in the context of both the regular order and the application sequence, and also to figure out the number of actual remainder operations performed.
The first question in the question is the application sequence, but since the application sequence is relatively simple, let's take a look at the application sequence:
(GCD 206 40)
(GCD 40 6)
(GCD 6 4)
(GCD 4 2)
(GCD 2 0)
2
Therefore (GCD 206 40) A total of 5 remainder functions were called.
Take a look at the case of the regular sequence:
(GCD 206 40)
(GCD (remainder 206 40))
(gcd (remainder 206) (Remainder (remainder (206 40)))
(GCD (Remainder (remainder (206))) (Remainder (remainder 206) (Remainder (remainder (206 40))))
(GCD (remainder (remainder 206) (Remainder (remainder (206 40)))) (Remainder (remainder (remainder (206))) (Remainder (remainder 206) (Remainder (remainder (206 40)))))
This is equivalent to the parameter is 2 and 0, where I have been removed, as to how many times the number of remainder calls to know.
"SICP Exercise" 7 Exercise 1.20