Skip to content
CalcGospel 國際數學圖譜
返回

IAL 2025 Jan D1 Q3

A Level / Edexcel / D1

IAL 2025 Jan Paper · Question 3

题目

Problem

Figure 2 shows the flowchart for an algorithm.

The input for the algorithm is two positive integers.

The function INT(X) is the largest integer less than or equal to X.

(a) Complete the table in the answer book, with a=1980a = 1980 and b=462b = 462, showing the results at each step of the algorithm.

(4)

(b) Explain how the output, hh, relates to the inputs, aa and bb.

(1)
题目中文翻译

图 2 显示了算法的流程图。

算法的输入是两个正整数。

函数 INT(X) 是小于或等于 X 的最大整数。

(a) 在答案本中完成表格,取 a=1980a = 1980b=462b = 462,显示算法每一步的结果。

(b) 说明输出 hh 与输入 aabb 的关系。

解答

(a)

解法一

思路

展开

先只计算一次 c=abc=ab,之后沿循环依次计算商 dd、整数部分 ee、乘积 ff 与余数 gg。若 g0g\ne0,用旧的 bb 与余数 gg 更新 a,ba,b;只有当 g=0g=0 时才计算 h=c/bh=c/b 并输出。

答题过程

展开

Initially,

c=1980×462=914760.c=1980\times462=914760.

Following the flowchart gives

aabbccd=a/bd=a/be=INT(d)e=\operatorname{INT}(d)f=bef=beg=afg=a-fhh
198046291476030/730/741848132-
4621329147607/27/2339666-
13266914760222132013860

At the final step,

h=91476066=13860.h=\frac{914760}{66}=13860.

Therefore, the output is

13860.\boxed{13860}.

(b)

解法一

思路

展开

循环部分是欧几里得算法:当余数首次变为 0 时,此时的 bb 是两个输入的最大公因数。由于 cc 始终等于两个原输入的乘积,所以输出 c/bc/b 等于“乘积除以最大公因数”,即最小公倍数。

答题过程

展开

The loop applies the Euclidean algorithm, so when g=0g=0, the current value of bb is the highest common factor of the two original inputs.

Since cc is their product,

h=abgcd(a,b)=lcm(a,b),h=\frac{ab}{\gcd(a,b)}=\operatorname{lcm}(a,b),

Hence hh is the

lowest common multiple of the two inputs.\boxed{\text{lowest common multiple of the two inputs}}.