Question: I have a question regarding a problem that is done in DrRacket . (Please don't answer in a different programming language, it doesn't help me

I have a question regarding a problem that is done in "DrRacket". (Please don't answer in a different programming language, it doesn't help me at all!)

.........................................

Question:

The famous computer scientist, Edsger Dijkstra, made the following observations for m and n >= 1:

1. If m = n, then the greatest common divisor of m and n is m.

2. If m > n, then the greatest common divisor of m and n is the greatest divisor of m-n and n.

Based on these observations, implement a function to compute the "greatest common divisor" of two given numbers >= 1. implement a function using the "structural recursive".

...................................................

Below is what I have so far. But i'm sure its wrong recording to the information above. can someone help fix this please?

;1. If m = n, then the greatest common divisor of m and n is m. ;2. If m > n, then the greatest common divisor of m and n is ; the greatest divisor of m-n and n. (define (greatest-common-divisor n m) (local [(define (first-divisor-<= i) (cond [(=i 1) 1] [else (cond [(and (= (remainder n i) 0) (= (remainder m i) 0)) i] [else (first-divisor-<= (sub1 i))])]))] (first-divisor-<= (min m n))))

(check-expect (greatest-common-divisor 0) 0) (check-expect (greatest-common-divisor 6 12 8) 2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!