在線即時計算器 · 純前端本地秒算 · 零數據上傳

📚 Euclidean Algorithm 計算機

專業免費的 Euclidean Algorithm 計算機。純前端本機毫秒級計算、零資料上傳、極致隱私保護。提供詳細公式推導、實例示範與常見問答。

即時推算結果 (Computed Output)
12 gcd(48, 36)
專業公認計算模型,即時運算完畢
📜 計算歷史記錄 (試算軌跡)
尚無歷史記錄,每次點擊「計算」將在此留下試算軌跡...

What Is Euclid's Algorithm?

Euclid's algorithm is one of the oldest known algorithms, described by the Greek mathematician Euclid around 300 BC. It finds the greatest common divisor (GCD) of two whole numbers — the largest number that divides both of them without leaving a remainder. This calculator applies the algorithm to any two non-negative integers and also returns their least common multiple (LCM).

How to Use It

Enter your two numbers in the fields labelled a and b and submit. The calculator returns the GCD as the main result and the LCM as a secondary value. Order does not matter — \gcd(48, 36) = \gcd(36, 48). Negative inputs are treated by their absolute value, and if one number is 0 the GCD is simply the other number.

The Formula Explained

The algorithm relies on a simple insight: any common divisor of a and b also divides their remainder a mod b. So we repeatedly replace the larger number with the remainder:

\gcd(a,b) = \gcd(b, a \bmod b), \gcd(a,0) = a

Each step shrinks the numbers quickly, so even huge values resolve in just a handful of iterations. The LCM is then computed as

lcm(a,b) = ((a × b) ÷ (\gcd(a,b)))

Worked Example

Find \gcd(48, 36):

48 \bmod 36 = 12 \to \gcd(36, 12)

36 \bmod 12 = 0 \to \gcd(12, 0) = 12

So the GCD is 12, and the LCM = \dfrac{48 × 36}{12} = \dfrac{1728}{12} = 144.

使用注意事項與精準校對原則(6 大核心守則)

📐 1. 嚴格對齊輸入量綱與單位

輸入各項數值時請務必確認量綱(例如小時、天數、金額、百分比),避免單位不匹配引發推算偏差。

🔒 2. 純前端本機毫秒級隱私保障

所有計算邏輯 100% 在您的終端瀏覽器內完成,資料絕不上傳伺服器,嚴格守護商業與個人隱私。

📊 3. 符合公認學術與產業計算模型

演算法嚴格遵循國際通用數學公式與標準計算模型,經多重情境交叉核對,數值嚴密精確。

📋 4. 一鍵複製與免登入 PDF 匯出

支援一鍵複製推算結果字串至剪貼簿,亦可直接點擊列印按鈕輸出純淨 PDF 工作報表。

🔄 5. 多情景敏感度動態對比

建議針對極端值與多組預期情景分別試算,觀察輸出數據的波動區間,輔助做出更穩健的決策。

🛡️ 6. 專業諮詢與日常參考免責聲明

本工具運算結果供日常排程、學業研習與事前參考之用,如涉及重大法規或投資決策請諮詢持證專家。

常見問題 (FAQ)

What if both numbers are 0?
The GCD of 0 and 0 is defined here as 0, and the LCM is also 0 since no positive multiple exists.
Why is it faster than listing factors?
Instead of finding every divisor, the algorithm uses the remainder shortcut, reducing the problem size dramatically each step — typically logarithmic time.
Can it handle very large numbers?
Yes. Euclid's algorithm is efficient even for numbers with many digits, needing only a small number of modulo operations.