Skip to content · ⁨Pular para o conteúdo⁩

Greatest common divisor · ⁨Máximo divisor comum⁩

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.

Português

Máximo divisor comum

O MDC de dois números é o maior inteiro que divide ambos. O algoritmo de Euclides é lindamente curto: enquanto b não for 0, substitua o par (a, b) por (b, a % b). Quando b chegar a 0, a será a resposta.

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP