GCD & LCM 计算器
找到数字列表中最常用的多位数和最小的多位数。
输入结果时更新 。
关于此计算器
This calculator finds the greatest common divisor (GCD) — the largest number that divides all your values evenly — and the least common multiple (LCM), the smallest number they all divide into. Enter two or more whole numbers separated by commas or spaces and it also tells you whether they are coprime.
The GCD is found with the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing the two until one becomes zero; the other is the GCD. The LCM is then built up pairwise using LCM = a × b ÷ GCD. For 12, 18 and 24 the greatest common divisor is 6 and the least common multiple is 72. When the GCD is 1 the numbers share no common factor and are called coprime.
The GCD is what you use to reduce a fraction to lowest terms, while the LCM gives the common denominator for adding fractions and the period at which repeating cycles line up. The result is the same no matter what order you enter the numbers in.
经常问到的问题
GCD是如何计算的?
它使用欧几里德算法:多次用两个除以的剩余部分取代较大的数字,直到一个变为零。另一个是GCD。
GCD和LCM之间如何联系?
对于两个数字,GCD x LCM = 数字的产物。因此,LCM = a x b = GCD,这就是工具如何将LCM扩展到整个清单。
同志情侣是什么意思?
两个或两个以上数字是合用的数字,而他们最大的共同点是1——除1外,他们没有共同点。
我能输入两个以上的数字吗?
是。 整个列表中都计算出带有逗号或空格以及GCD和LCM的完整数字。
12、18和24的通用会计分类和统一分类和分类法是什么?
最常见的是6个(所有三个数字中最大的一个是最大的一个),最不常见的数是72个。
数字顺序重要吗?
不,不管您输入数字的顺序,GCD和LCM都是相同的。
API - 使用代码中的计算器
将此计算器称为自由 JSON 端点 。 不需要按键 。 将字段值发送到下面作为查询参数或 JSON 。 任何您省略的, 都会使用相同的默认值, 此页面预填的默认值是预填的; 未知参数是 400, 而不是静音零 。 读取 API 全部文件 →
终点
GET https://calculator.free/api/v1/gcd-lcm/
curl
curl "https://calculator.free/api/v1/gcd-lcm/?numbers=12, 18, 24"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/gcd-lcm/?" + new URLSearchParams({
"numbers": "12, 18, 24"
}));
const data = await r.json();
console.log(data.results);
成果仅是一般指导的估计数,而不是财务、医疗或税务咨询。