{
  "familyId": "math.lcm",
  "version": 1,
  "status": "draft",
  "name": "兩個正整數最小公倍數",
  "scope": "恰好兩個已確認、1至20位的十進位正整數，求其最小公倍數。",
  "exclusions": [
    "零與負數",
    "分數或小數記法",
    "三個以上數",
    "複雜排程或週期文字題未建立條件子型",
    "未確認OCR",
    "超過20位整數另立支援範圍"
  ],
  "parameterSchema": {
    "type": "object",
    "required": [
      "a",
      "b",
      "confirmed"
    ],
    "properties": {
      "a": {
        "type": "string",
        "pattern": "^[1-9][0-9]{0,19}$"
      },
      "b": {
        "type": "string",
        "pattern": "^[1-9][0-9]{0,19}$"
      },
      "confirmed": {
        "const": true
      },
      "extraNumbers": {
        "type": "array",
        "maxItems": 0
      }
    },
    "additionalProperties": false,
    "notes": "先確認缺失或未確認條件，再檢查只含兩個正整數。0、負數、分數及小數字面記法均不屬此子型；使用精確 BigInt，不能轉成浮點數。"
  },
  "methods": [
    {
      "methodId": "lcm.enumeration",
      "version": 1,
      "applicability": "教學預設；a、b≤200且預計 L/a、L/b 皆≤40，已理解倍數。預計上限由受控計算器決定；超範圍不能硬列舉。",
      "steps": [
        {
          "id": "s1",
          "stage": 0,
          "title": "確認求最小共同倍數",
          "instruction": "確認兩個正整數及目標是公倍數。",
          "hint": "公因數與公倍數方向不同。",
          "check": "條件與數值來源確認。"
        },
        {
          "id": "s2",
          "stage": 1,
          "title": "依序列出倍數",
          "instruction": "由a、2a…與b、2b…列到首次共同值L。",
          "hint": "這裡只列正倍數，不把0當答案。",
          "check": "每列項目等於對應原數乘上連續正整數，末項皆L。"
        },
        {
          "id": "s3",
          "stage": 2,
          "title": "找首次重合",
          "instruction": "標出兩列共同的末值L。",
          "hint": "要找最早的共同值。",
          "check": "L/a與L/b為正整數，完整序列沒有更早重合。"
        },
        {
          "id": "s4",
          "stage": 3,
          "title": "驗最小性",
          "instruction": "確認L是公倍數且不存在較小正公倍數。",
          "hint": "用gcd做獨立交叉核對。",
          "check": "L*gcd(a,b)=a*b，且L=(a/gcd(a,b))*b。"
        }
      ],
      "validatorRefs": [
        "input.confirmed-conditions",
        "input.positive-integer-pair",
        "lcm.multiple-minimality-product"
      ],
      "diagramRefs": [
        "math.lcm.multiple-list"
      ]
    },
    {
      "methodId": "lcm.prime-factorization",
      "version": 1,
      "applicability": "a、b≤1000000，已理解質數分解與次方；不會時先教必要概念。更大整數改 gcd-product，避免不受控因數分解耗時。",
      "steps": [
        {
          "id": "s1",
          "stage": 0,
          "title": "確認質因數觀念",
          "instruction": "確認a、b為正整數；1的質因數列表為空，不將1列為質數。",
          "hint": "質數只能分解成1與自己。",
          "check": "來源已確認；每因子通過質數核對。"
        },
        {
          "id": "s2",
          "stage": 1,
          "title": "分解兩個數",
          "instruction": "把a、b各寫成質數與次方乘積。",
          "hint": "每次除以能整除的質數。",
          "check": "兩個分解乘积各等於a、b，所有因子為質數。"
        },
        {
          "id": "s3",
          "stage": 2,
          "title": "取各質數最大次方",
          "instruction": "對聯集每個質數取兩邊最大指數。",
          "hint": "要能包含兩數需要的所有質因數。",
          "check": "每質數指數=max(ea,eb)，沒有無來源質因數。"
        },
        {
          "id": "s4",
          "stage": 3,
          "title": "乘回並確認",
          "instruction": "相乘得到L，核對公倍數与最小性。",
          "hint": "每個所需質因數都足夠且沒有多取。",
          "check": "整除、最小指數證據、L*gcd(a,b)=a*b 同時通過。"
        }
      ],
      "validatorRefs": [
        "input.confirmed-conditions",
        "input.positive-integer-pair",
        "lcm.multiple-minimality-product",
        "lcm.prime-factor-trace"
      ],
      "diagramRefs": [
        "math.lcm.prime-exponents"
      ]
    },
    {
      "methodId": "lcm.gcd-product",
      "version": 1,
      "applicability": "大數 fallback；只有已理解 gcd 與公倍數關係才做教學解說，否則先補觀念。計算仍可用此法精確獨立校驗。",
      "steps": [
        {
          "id": "s1",
          "stage": 0,
          "title": "確認兩數與共同因數",
          "instruction": "取得已核對的d=gcd(a,b)。",
          "hint": "先確定最大公因數正確。",
          "check": "d整除a,b，輾轉trace通過。"
        },
        {
          "id": "s2",
          "stage": 1,
          "title": "先除共同部分",
          "instruction": "算a/d，保存整數商。",
          "hint": "避免把共同因數重複計算。",
          "check": "a=d*(a/d)且無餘數。"
        },
        {
          "id": "s3",
          "stage": 2,
          "title": "再乘另一數",
          "instruction": "算L=(a/d)*b。",
          "hint": "使用精確整數，不用浮點數。",
          "check": "每步等式與原數一致。"
        },
        {
          "id": "s4",
          "stage": 3,
          "title": "交叉確認",
          "instruction": "驗L/a及L/b為整數，L*d=a*b。",
          "hint": "此關係只用於已確認的兩個正整數。",
          "check": "gcd(a/d,b/d)=1以證明沒有更小公倍數；L>0。"
        }
      ],
      "validatorRefs": [
        "input.confirmed-conditions",
        "input.positive-integer-pair",
        "lcm.multiple-minimality-product"
      ],
      "diagramRefs": [
        "math.lcm.gcd-product-table"
      ]
    }
  ],
  "svgTemplateSpecs": [
    {
      "templateId": "math.lcm.multiple-list",
      "version": 1,
      "parameters": [
        "a",
        "b",
        "multiplesA",
        "multiplesB",
        "answer"
      ],
      "domainGuards": [
        "a,b≤200",
        "answer/a≤40且answer/b≤40",
        "multiplesA=[a*i],multiplesB=[b*i]，i自1連續至answer",
        "answer符合整除、最小性、乘積關係"
      ],
      "primitives": [
        "两列可換行正倍數格",
        "首次共同值同色框",
        "答案框與原數整除關係",
        "圖例：列舉到第一個共同倍數；不是全部倍數"
      ],
      "revealSequence": [
        "stage0兩數標題",
        "stage1按序逐批顯示，最多每頁10項",
        "stage2首次共同值連線",
        "stage3答案與L÷a、L÷b核對"
      ],
      "fallback": "超出列舉守門改質因數指數表或gcd-product-table；不能砍掉中間倍數仍宣稱最小。"
    },
    {
      "templateId": "math.lcm.prime-exponents",
      "version": 1,
      "parameters": [
        "a",
        "b",
        "primeFactorsA",
        "primeFactorsB",
        "maxExponents",
        "answer"
      ],
      "domainGuards": [
        "a,b≤1000000",
        "每分解乘回原值且質數有效",
        "每質數指數取最大",
        "1以空乘積1表示"
      ],
      "primitives": [
        "質數列、兩數指數欄與最大指數欄",
        "已選最大指數框",
        "可展開乘積與答案"
      ],
      "revealSequence": [
        "兩數",
        "分解欄",
        "最大指數",
        "乘積與驗算"
      ],
      "fallback": "缺前置觀念先解說例子；超出因數分解範圍改gcd-product-table。"
    },
    {
      "templateId": "math.lcm.gcd-product-table",
      "version": 1,
      "parameters": [
        "a",
        "b",
        "gcd",
        "quotient",
        "answer"
      ],
      "domainGuards": [
        "a=gcd*quotient",
        "answer=quotient*b",
        "gcd及乘積校驗通過"
      ],
      "primitives": [
        "原數與gcd",
        "a÷gcd=quotient",
        "quotient×b=answer",
        "L÷a、L÷b整數核對"
      ],
      "revealSequence": [
        "兩數",
        "最大公因數",
        "先除後乘",
        "答案與驗算"
      ],
      "fallback": "精確長數換行；不截斷與不近似。"
    }
  ],
  "review": {
    "humanTeacherReviewed": false,
    "machineReview": "pending-mainline-validation",
    "promotionRule": "離線草稿案例通過不等於 approved，不接學生評分。"
  }
}
