通过列举因数求最大公因数

通过列举因数求最大公因数
几何画板及绘图内容加载中,请稍等……
2020-08-19 17:40
① 本范例演示如何通过列举两个整数的所有因数,找出它们的公因数并确定最大公因数(HCF)的完整过程。② 涉及的核心数学概念包括最大公因数、因数、整数除法、公因数集合及其交集运算。③ 作图要点:利用 GeoGebra 命令 Append、If、Intersection、Zip 以及对象 box1、box2、listNum、listFactor1、listFactor2、listCF、buttonSetPos、button0、buttonLang、slider 等,实现因数的动态生成、条件筛选、交集计算与交互式高亮显示。④ 适用于小学高年级至初中数学课堂教学,也可作为自学演示或教学辅助素材。

GeoGebra 命令及参数

  1. Append("", Sequence[Text[i], i, 1, 100]) → listNum
  2. If(SelectedIndex[listNum2] > 1, SelectedIndex[listNum2] - 1) → n2
  3. If(Defined[n2], Reverse[KeepIf[IsInteger[k], k, Sequence[n2 / i, i, 1, n2]]], {0}) → listFactor2
  4. If(SelectedIndex[listNum1] > 1, SelectedIndex[listNum1] - 1) → n1
  5. If(Defined[n1], Reverse[KeepIf[IsInteger[k], k, Sequence[n1 / i, i, 1, n1]]], {0}) → listFactor1
  6. Intersection(listFactor1, listFactor2) → listCF
  7. If(listFactor1 ≟ {0} ∨ t1 ≟ 0, {0}, First[listFactor1, t1]) → listFactor1Partial
  8. If(Length[listFactor1] ≤ 1, 1, Length[listFactor1]) → t1max
  9. If(Length[listFactor2] ≤ 1, 1, Length[listFactor2]) → t2max
  10. Zip(If[IndexOf[k, listCF] ≥ 1 ∧ box1, "\red{", ""] + (Text[k]) + (If[IndexOf[k, listCF] ≥ 1 ∧ box1, "}", ""]) + "\,,\,", k, listFactor1Partial) → listFactorText1
  11. If(listFactor2 ≟ {0} ∨ t2 ≟ 0, {0}, First[listFactor2, t2]) → listFactor2Partial
  12. Zip(If[IndexOf[k, listCF] ≥ 1 ∧ box1, "\red{", ""] + (Text[k]) + (If[IndexOf[k, listCF] ≥ 1 ∧ box1, "}", ""]) + "\,,\,", k, listFactor2Partial) → listFactorText2
  13. If(listFactorText1 ≟ {}, " ", Sum[listFactorText1] + " ") → textSum1
  14. If(listFactorText2 ≟ {}, " ", Sum[listFactorText2] + " ") → textSum2