Greatest common divisor pseudocode

算法:def Euclidean(a, b):
max = a if a > b else b
min = b if a > b else a
if max % min == 0:
return min
else:
return Euclidean(min, max-min*int(max/min))

Links: https://blog.csdn.net/weixin_42239402/article/details/88061908

Pseudocode: if m <n, then m↔n, in order to ensure that m> n.
M is divided by the number of seeking r n obtained.
If r is 0, the algorithm ends, n is the answer.
If r is not 0, then m ← n, n ← r, jump to step 2.

Guess you like

Origin www.cnblogs.com/1208499954qzone/p/11791041.html