Find $GCD$ of $2021019$ and $1431471$
My solution:
$2021019 = 1\cdot(1431471) + 589548$
$1431471 = 2\cdot(589548) + 252375$
$589548 = 2\cdot(252375) + 84798$
$252375 = 2\cdot(84798) + 82779$
$84798 = 1\cdot(82779) + 2019$
$82779 = 41\cdot(2019)$
So $GCD$ of $2021019$ and $1431471$ is $2019$
Are there any other ways to solve this faster?
You can apply standard divisibility tests for certain prime factors, and thereby divide out any factors that "pass" to get smaller numbers. With base 10 representation we have reasonably easy tests for $2,3,5,7,11,13,37$. Letting $a=2021019$ and $b=1431471$ we apply these tests:
$2$ -> both odd final digits, both fail.
$3$ -> both give a digit sum divisible by $3$, divide both inputs by $3$ and note that the hlgcd willthen also be divided by $3$. Thus $a\to673673, b\to477157$.
$3$ again -> we see if we can extract another factor of $3$, but the sum of digits no longer passes for either input.
$5$ -> neither input ends in $0$ or $5$.
$11$ -> alternating sum of digits is divisible by $11$ for $a$ but not for $b$. Divide $a$ by $11$. $a\to61243,b=477157$.
$7,13$ -> alternating sum of three-digit groups is divisible by both of these factors for $a$ ($182=13×14$) but not for $b$. Divide $a$ by both factors or in one step by their product $91$. $a\to673,b=477157$.
$37$ -> sum of groups of three digits. This gives just $673$ back for $a$ but since that is $111×6+7$ it will not be divisible by $37$. For $b$ we get $634=111×6-32$, so this fails. Retain $a=673,b=477157$.
So we reduce to finding the gcd of 673 and 477157, then we have to multiply by $3$ because we commonly divided $a$ and $b$ by $3$ during the above reductions. It happens that $477157$ gives a zero remainder when divided by $673$, therefore render $673×3=2019$.