LCM & GCD Calculator|最小公倍数与最大公约数

最小公倍数与最大公约数计算器 | LCM & GCD Calculator

最小公倍数与最大公约数计算器 LCM & GCD Calculator

输入多个整数(支持逗号、空格或换行分隔),一键计算 最大公约数 GCD最小公倍数 LCM
Enter multiple integers (comma/space/newline separated) and calculate GCD and LCM instantly.

1. 输入参数 · Integers Input
你可以用 逗号空格换行 混合分隔。支持负数(会按绝对值参与运算)。
Use comma / space / newline as separators. Negative values are allowed (computed using absolute values).

小提示:如果包含 0,则:
• GCD(a, 0) = |a|;GCD(0, 0) = 0
• LCM(a, 0) = 0(只要有一个为 0)
Tip: If any value is 0, LCM becomes 0 (as long as at least one number is 0).
显示合并过程 会把“多个数”按两两归并(reduce)展示出来:先算前两个,再把结果与下一个继续算。
“Show steps” displays how multiple numbers are reduced pairwise: compute first two, then combine with the next, etc.
3. 使用说明 · Notes
  • 输入格式 / Input format:
    你可以把数字写成一行,也可以每行一个数字;分隔符支持逗号 ,、空格、Tab、换行混用。比如:
    12, 18, 3012 18 30 或:
    12 18 30
    You can provide numbers in one line or one per line. Separators can be commas/spaces/tabs/newlines mixed.
  • 关于负数 / About negative numbers:
    GCD 与 LCM 通常在整数的绝对值意义下讨论,所以本工具会对输入自动取绝对值参与计算:
    gcd(-12, 18) = gcd(12, 18)
    This tool uses absolute values for GCD/LCM because that’s the common convention for integers.
  • 关于 0 / About zero:
    gcd(a, 0) = |a|,且 gcd(0, 0) = 0(约定)。
    lcm(a, 0) = 0:只要有一个数是 0,最小公倍数就为 0(因为 0 是所有数的倍数)。
    • 若你希望“忽略 0”,请手动从输入里删掉 0。
    If you want to ignore zeros, remove them manually before calculating.
  • 什么时候用 GCD / LCM? / When to use GCD / LCM?
    GCD(最大公约数):常用于分数约分、比例化简、把多个长度/周期“对齐到最大共同单位”。
    LCM(最小公倍数):常用于时间表/周期问题(例如每 6 天/8 天一次的任务何时同日发生)、多种包装规格的“最小共同整箱数”等。
    GCD helps simplify ratios/fractions; LCM helps align cycles/schedules to a common repetition point.
  • 性能与数值范围 / Performance & range:
    本工具内部使用 BigInt 进行计算(可处理非常大的整数),但浏览器对超长文本、极多数字的粘贴仍有性能上限。建议一次控制在几百个数字以内。
    Internally uses BigInt so it can handle very large integers, but your browser still has practical limits. Keep the input to a reasonable size (e.g., under a few hundred numbers).

免责声明:本工具仅用于学习、演算与日常快速核对,不构成任何法律、财务或工程建议。
Disclaimer: For learning and quick estimation only; not legal/financial/engineering advice.