Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Greatest common divisor · ⁨ตัวหารร่วมมากที่สุด⁩

English

Greatest common divisor

The GCD of two numbers is the largest integer that divides both. Euclid's algorithm is beautifully short: while b isn't 0, replace the pair (a, b) with (b, a % b). When b reaches 0, a is the answer.

ไทย

ตัวหารร่วมมาก

GCD ของจำนวนสองจำนวนคือจำนวนเต็มที่มีค่ามากที่สุดที่หารทั้งสองจำนวนได้ อัลกอริทึมของยูคลิด มีรูปแบบที่สั้นอย่างสวยงาม: пока b ไม่เป็น 0 ให้แทนคู่ (a, b) ด้วย (b, a % b) เมื่อ b ถึง 0 ค่า a คือคำตอบ

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP