Skip to content / Đến nội dung
ThichHocToan.com

AMO 2023 – Junior College (Grade 11–12) Question 6

AMO · AMO 2023 – Junior College (Grade 11–12)

Question 6

For positive integers, define $\operatorname{Euclid}(a,b)$ as follows: if $a\bmod b=0$, return $b$; otherwise return $\operatorname{Euclid}(b,a\bmod b)$. Here $a\bmod b$ is the remainder when $a$ is divided by $b$. What is $\operatorname{Euclid}(36,50)$?

Question illustration

Code notation: def defines a function; if/else selects a branch; return gives its result; print displays it; % means remainder and == tests equality.
  1. 9
  2. 6
  3. 3
  4. 2