Recurrence Formula for GCD of Two Numbers
The core formula given in the video is: For any integer , . The instructor emphasizes this is the key recurrence relationship to master for finding the greatest common divisor of two numbers.
南瓜之运 · Bilibili · 4:14
The segment first uses a document to present the recurrence formula for the greatest common divisor of two numbers , explaining that the Subtraction Method and the Euclidean Algorithm are special cases for and respectively. It then switches to C++ code, calling `gcd(a,b)` with `` and ``, where the terminal outputs 24, verifying . The instructor also reminds that the demo environment allows direct use of `gcd` due to a newer C++ version, but exam environments may require manual implementation. The clip first uses C++ code to enumerate to , checking whether always equals ; the terminal only outputs asterisks, indicating no counterexamples in the test range. It then switches to the lecture, presenting the GCD recurrence formula , and explains two special cases: yields the subtraction-based algorithm , and yields the Euclidean algorithm .
Use the learning inspector for key ideas and moments, or open the reading tabs for the complete notes.
Generated from the video's visuals and explanation; not verbatim speech.
The video starts by showing a dark-background document titled "Recurrence Formula for the Greatest Common Divisor of Two Numbers". The instructor first states the goal of this section is to find the recurrence formula for the greatest common divisor of two numbers, emphasizing that for beginners in competitive programming, mastering one core formula is sufficient.
The document gives the core formula: For any integer , . Here is an arbitrary integer parameter, and are the two integers whose greatest common divisor is being sought.
Next, the document specializes the formula into two common methods. First set , obtaining the subtraction method: . In , this step replaces the with 1.
Second, let , yielding the Euclidean Algorithm: . The video directly gives this conclusion; supplementarily, it is usually because .
The screen then switches to a C++ code editor. The instructor starts giving a numerical example, declaring `const int ;` and `const int ;` in the `main` function, preparing to calculate the greatest common divisor of these two integers.
The code writes `cout << gcd(a, b) << endl;` and runs. The terminal outputs `24`, thus the example verifies . The instructor also verbally confirms "The result is 24".
The instructor explains that writing `gcd(a,b)` directly here is possible because the C++ version he uses is relatively new, and the environment comes with the function built-in. However, he immediately reminds that the C++ compiler version during exams might not be this new, and one might need to implement the gcd function themselves at that time.
Afterwards, for , the instructor records the greatest common divisor answer as 24 and adds `const int c = gcd(a, b);` to prepare for the next discussion.
At the end of the segment, the instructor returns to the range of parameter , saying one can let go from negative 1024 to positive 1024, and writes `for (int ;k<=1024;++k)` in the code. He begins asking if there exists some such that satisfies subsequent conditions, but the sentence is not finished before the segment ends.
On the left is a C++ program in VS Code, on the right is the terminal. The code sets `const int ;`, `const int ;`, `const int c = gcd(a, b);`, then iterates integer using `for (int ; k<=1024; ++k)`. Inside the loop, it checks `if (c != gcd(b, ))`, printing the current if they are not equal.
To mark the complete execution of the program, `cout << "**********" << endl;` is added at the end. The narrator explains that these asterisks are just a marker for program completion.
After recompiling and running, the terminal only displays `**********`, with no shown. Since the program only prints when `c != gcd(b, )`, this indicates no counterexamples were found in the test range .
Based on this, the narrator concludes: For any integer , always holds. The mathematical content here is that the greatest common divisor remains invariant after replacing the first argument with and swapping the argument order.
The screen switches to a black-background white-text lecture titled "1 Recurrence Formula for GCD of Two Numbers". The text states "For any integer : ". This is the core recurrence formula of this clip.
The lecture continues to show two special cases. Section 1.1 "Subtraction-based Algorithm" reads: "Let , we get the subtraction-based algorithm: ." This step simply substitutes with 1 in the general formula, so becomes .
Section 1.2 "Euclidean Algorithm" reads: "Let , we get the Euclidean algorithm: ." The narrator explains that is the quotient of divided by , so is the dividend minus quotient times divisor, i.e., the remainder .
On screen, the pink annotation writes first and places above it, with an arrow to below. This connects the general recurrence to the Euclidean algorithm and shows that the latter is the special case .
The core formula given in the video is: For any integer , . The instructor emphasizes this is the key recurrence relationship to master for finding the greatest common divisor of two numbers.
Letting in the core formula yields . This is the Subtraction Method labeled in the document, essentially replacing one parameter with the difference of the two numbers each time.
Letting in the core formula, the document directly gives . Supplementary explanation: Usually because , it is also a special case of the core formula.
The video sets `` and `` in C++ code, calls `gcd(a,b)` and outputs the result. The terminal displays `24`, thus the example verifies .
The instructor explains that the demo environment can call `gcd(a,b)` directly because the C++ version used is relatively new; however, the compiler version in exam environments might be older, so one cannot assume the function definitely exists and may need to implement it manually if necessary.
The core formula presented in the video is: For any integer , . It states that when calculating the greatest common divisor of two integers, one argument can be replaced by the integer multiple difference of the other argument, and swapping argument positions leaves the result unchanged. The code example uses , , and for enumeration testing, with the terminal outputting no counterexample .
The subtraction-based algorithm is a special case of the recurrence formula when . After substituting , the second argument becomes , yielding . Lecture section 1.1 explicitly writes out this derivation.
The Euclidean algorithm is a special case of the recurrence formula when . At this point, , which the narrator explains is the dividend minus quotient times divisor, equal to the remainder , thus yielding . The video does not explicitly state that division requires .
The code first sets , , , then iterates to . If occurs, the program prints that ; after the loop ends, it prints `**********` as a completion marker. The terminal only displays `**********`, indicating no counterexamples were found in the test range.
Explore conditions, steps and evidence. Supplementary explanations are labeled separately from content shown in the video.
The document repeatedly shows , and the code calls .
The instructor says "greatest common divisor" multiple times.
The greatest common divisor function for two integers.
The video does not specify the exact domain; non-negative integers are used in the examples.
The document formula is written as .
The code declares `const int ;` and `const int ;`.
The two integers involved in finding the greatest common divisor.
Integers in the example; the video does not give general restrictions.
The document states "For any integer : ."
The instructor says "First let be an arbitrary integer."
The code loop is written as `for (int ;k<=1024;++k)`.
An arbitrary integer parameter in the recurrence formula.
Any integer.
The document writes .
The video does not explain the definition of `mod`, sign conventions, or handling when .
The remainder term in the Euclidean algorithm formula.
Not specified in the video.
The document writes "Let ."
The video does not state that this expression is undefined when .
The integer quotient obtained by taking the floor of .
Not specified in the video.
The code contains `const int ;`, `const int ;`, and `for (int ;k<=1024;++k)`.
`int`
The integer type used in C++ to declare the example variables.
The video does not specify the range of values.
The code writes `cout << gcd(a, b) << endl;`.
The instructor says "I directly used the gcd function here... my C++ version is relatively new now, so it comes with the gcd function built-in."
The video does not specify which standard library header file is used; the screen shows `#include <bits/stdc++.h>`.
`gcd(a, b)`
A call to the greatest common divisor function in C++ code.
Two `int` values are passed in the example.
Code line 6 `const int ;`; Lecture section 1 formula contains
When deriving , the narrator calls it “the quotient of divided by .”
a
The first integer participating in the greatest common divisor calculation; takes the value 24 in the code example
Integer
Code line 7 `const int ;`; Lecture section 1 formula contains
The narrator says " divided by , rounded down"
b
The second integer participating in the greatest common divisor calculation; takes the value 504 in the code example
Integer
Code line 8 `const int c = gcd(a, b);`; Line 11 `if (c != gcd(b, ))`
The narrator says "if c is not equal to it"
c
Variable in the code storing the result of
Integer
Code line 10 `for (int ; k<=1024; ++k)`; Lecture section 1 "For any integer : "
The narrator says "for any ", "for example when equals 1", "let equal divided by , rounded down"
k
Integer parameter in the recurrence formula; iteration range in code is -1024 to 1024
Integer
Code line 8 `gcd(a, b)`; Lecture section 1 formula
The narrator reads "gcd a b equals gcd b a minus k times b"
Greatest common divisor function
Operates on two integers, returns an integer
The document title is "Recurrence Formula for the Greatest Common Divisor of Two Numbers".
The document body states "For any integer : ."
The instructor says, “This time we will discuss the recurrence formula for the greatest common divisor of two numbers,” and “First let be an arbitrary integer; then the greatest common divisor of and equals the greatest common divisor of minus times .”
The core formula given in the video transforms into , where can be any integer. The instructor emphasizes that for beginners in competitive programming, mastering this single formula is sufficient.
is any integer.
The video does not specify additional restrictions on .
The document subsection title is "1.1 Subtraction Method".
The document writes "Let , to get the Subtraction Method: ."
This is a special case of the core recurrence formula when , replacing the first parameter with the difference of the two numbers each time.
Derived from the core formula by letting .
The video does not specify size relationships or sign restrictions for .
The document subsection title is "1.2 Euclidean Algorithm".
The document writes "Let , to get the Euclidean Algorithm: ."
The video does not explain the definition of `mod`, handling of , or the relationship between the floor quotient and remainder.
This is a special case of the core recurrence formula when , replacing the first parameter with the remainder of divided by .
Derived from the core formula by letting .
The video does not mention the usual prerequisite .
The code calls `gcd(a, b)`.
The instructor says "I directly used the gcd function here because my C++ version is relatively new now, so it comes with the gcd function built-in."
The instructor also says "But during exams, the C++ compiler version might not be this new, so you may need to implement the gcd function yourself during exams. We will discuss how to implement it later."
The video does not specify the exact C++ standard version or header file; the screen shows `#include <bits/stdc++.h>`.
The video demonstrates calling `gcd(a,b)` directly in a newer C++ environment to calculate the greatest common divisor, while reminding that exam environments may not support this built-in function and require manual implementation.
The video states the current C++ version is relatively new.
The video does not specify the exact standard version.
Lecture title "1 Recurrence Formula for GCD of Two Numbers"; Text "For any integer : "
The narrator says "For any , gcd a b equals gcd b a minus times , always holds", "The first systematic professional recurrence formula we need to master"
The video presents the recurrence identity for the greatest common divisor: for any integer , . This formula transforms the GCD of into the GCD of , serving as the unified source for the subsequent subtraction-based algorithm and the Euclidean algorithm.
are integers
is any integer
Lecture section 1.1 "Subtraction-based Algorithm"; "Let , we get the subtraction-based algorithm: "
The narrator says "For example, when equals 1, we get gcd a b equals gcd b a minus b, this is the famous subtraction-based algorithm"
In the recurrence formula , set to obtain . The video names this special case the subtraction-based algorithm.
are integers
Lecture section 1.2 "Euclidean Algorithm"; "Let , we get the Euclidean algorithm: "
The narrator says "If we let equal divided by , rounded down... we get gcd a b equals gcd b a modulo b remainder, this is the famous Euclidean algorithm"
In the recurrence formula , set . Then is the remainder of divided by , giving . The video names this special case the Euclidean algorithm.
are integers
Video does not state
The document writes "For any integer : ."
The instructor repeats the formula and says "It is this formula."
The video does not provide a proof.
For any integer , .
is any integer.
The video does not specify additional restrictions on .
Holds for any integer .
The document writes "Let , to get the Subtraction Method: ."
When , the core recurrence formula becomes .
The core formula holds.
Take .
Direct substitution within the formula framework given in the video.
The document writes "Let , to get the Euclidean Algorithm: ."
The video does not specify nor the precise definition of `mod`.
When , the core recurrence formula becomes .
The core formula holds.
Take .
Usually requires , though not stated in the video.
Direct substitution within the formula framework given in the video.
The code has `const int ;` and `const int ;`.
The terminal outputs `24`.
The instructor says "The result is 24" and "When , their greatest common divisor answer is 24."
In this example, .
.
.
For the given numerical instance.
The instructor says "But during exams, the C++ compiler version might not be this new, so you may need to implement the gcd function yourself during exams."
The video does not specify the exact exam platform or compiler version.
The video warns that the C++ compiler version in exams might be older, so one cannot assume the `gcd` function is available and must be prepared to implement it manually.
The C++ compiler version in the exam environment might not be as new as the demo environment.
Stated as a general warning in the video, without formal quantifiers.
The narrator says "That is to say, for any , gcd a b equals gcd b a minus times , always holds"
Lecture section 1 writes "For any integer : "
After running the program in the terminal, only `**********` is output, with no satisfying the condition `c != gcd(b, )`
For any integer , holds.
are integers
is any integer
Any integer
Lecture section 1.1 "Let , we get the subtraction-based algorithm: "
The narrator says "When equals 1, we get gcd a b equals gcd b a minus b, this is the famous subtraction-based algorithm"
Letting , the recurrence formula reduces to .
are integers
Existence of specific value
Lecture section 1.2 "Let , we get the Euclidean algorithm: "
The narrator says "If we let equal divided by , rounded down... we get gcd a b equals gcd b a modulo b remainder, this is the famous Euclidean algorithm"
Video does not explicitly state the division prerequisite
Letting , then , thus .
are integers
Video does not state
Existence of specific value
The document first gives , then writes "Let , to get the Subtraction Method: ."
Start from the core recurrence formula given in the video.
The document directly provides this formula.
Set the parameter to 1.
The document writes "Let ."
Substitute to get the form of the Subtraction Method.
Substitute into the equality .
The Subtraction Method is a special case of the core recurrence formula when .
The document first gives , then writes "Let , to get the Euclidean Algorithm: ."
The video does not show the intermediate explanation from to .
Start from the core recurrence formula given in the video.
The document directly provides this formula.
Set the parameter to the floor of .
The document writes "Let ."
Substitute to get the form of the Euclidean Algorithm.
The document directly gives this conclusion; supplementary explanation: usually because .
The Euclidean Algorithm is a special case of the core recurrence formula when .
The code sets `const int ;` and `const int ;`.
The terminal outputs `24`.
The instructor says "The result is 24."
Set the example values.
These constants are declared in the code.
Call the greatest common divisor function to calculate the example value.
The code writes `cout << gcd(a, b) << endl;`.
The program output is 24.
The terminal displays `24`, and the instructor confirms it verbally.
For the example values , the video verifies through program output.
Code lines 6-12: `const int ; const int ; const int c = gcd(a, b); for (int ; k<=1024; ++k) { if (c != gcd(b, )) { cout << k << endl; } }`
Terminal at seconds 31-33 shows compilation and execution output `**********`, with no values output
The narrator says "You will find that this program only outputs a bunch of asterisks", "That is to say, for any , gcd a b equals gcd b a minus times , always holds"
Code defines `#define int int64_t` redefining `int` as 64-bit integer, but video does not explain its impact on the example's numerical range
The code first fixes , , and stores in variable .
Directly given by code lines 6-8 in the video.
The program iterates integer from -1024 to 1024, checking whether is not equal to .
Directly given by code lines 10-11 in the video.
The execution result shows no satisfying `c != gcd(b, )`, only outputting the asterisk marker after the loop ends.
Terminal output at seconds 31-33 shows `**********`.
Since no counterexample was found within the test range, the narrator concludes that the recurrence equality holds for any integer .
Narrator summarizes at seconds 39-48 "For any ... always holds".
Code enumeration verification supports having no counterexamples within the test range, which the narrator generalizes to hold for any integer .
Lecture section 1 ; Section 1.1 "Let , we get the subtraction-based algorithm: "
The narrator says "For example, when equals 1, we get gcd a b equals gcd b a minus b, this is the famous subtraction-based algorithm"
Start from the general recurrence formula given in the video.
Formula from Lecture section 1.
Let parameter take the value 1.
Lecture section 1.1 "Let ".
Substitution yields the form of the subtraction-based algorithm.
Substituting into gives .
The subtraction-based algorithm is a special case of the general recurrence formula when .
Lecture section 1 ; Section 1.2 "Let , we get the Euclidean algorithm: "
The narrator says " divided by , rounded down is the quotient of divided by ", "Dividend minus quotient times divisor equals remainder"
At seconds 99-107, formula receives the handwritten annotation above it, then an arrow points to .
Video does not explicitly state the division prerequisite
Start from the general recurrence formula given in the video.
Formula from Lecture section 1.
Let parameter take the floor of divided by , i.e., the quotient.
Lecture section 1.2 "Let "; Narrator calls it "the quotient of divided by ".
Substitute into the second argument.
Algebraic substitution.
Narrator explains that dividend minus quotient times divisor equals remainder.
Narrator states at seconds 107-112 "Dividend minus quotient times divisor equals remainder".
Obtain the form of the Euclidean algorithm.
Formula from Lecture section 1.2.
The Euclidean algorithm is a special case of the general recurrence formula when .
The code has `const int ;`, `const int ;`, and `cout << gcd(a, b) << endl;`.
The terminal outputs `24`.
The instructor says "For example, let's take an example", "Let integer equal... 24", "Let integer equal... 504", "The result is 24."
Given two integers and , find their greatest common divisor.
.
.
Use C++ code to call `gcd(a,b)`.
Calculate and output the result.
Declare the first integer in the code.
The code line is visible on screen.
Declare the second integer in the code.
The code line is visible on screen.
Call the `gcd` function and output the result.
The code line is visible on screen; the instructor explains using the built-in `gcd` function of C++.
The terminal displays the program output.
The terminal area on screen shows `24`.
.
The video verifies the result by running the C++ program and outputting 24 in the terminal.
Code lines 6-15 fully visible: `const int ; const int ; const int c = gcd(a, b); for (int ; k<=1024; ++k) { if (c != gcd(b, )) { cout << k << endl; } } cout << "**********" << endl;`
Terminal at seconds 31-33 shows `$ .cpp && ./a.out` followed by output `**********`
The narrator says "You will find that this program only outputs a bunch of asterisks"
Video does not show the implementation of the `gcd` function, only the call result
Given , , let , iterate integer from -1024 to 1024, check if there exists .
Determine if there is any in the test range such that .
First calculate and store .
Code line 8 `const int c = gcd(a, b);`.
For each integer , check if the equality fails; if so, print .
Code lines 10-12.
After the loop ends, print asterisk marker to indicate program completion.
Code line 15; Narrator says "To mark that my entire program has finished running, we finally output a bunch of asterisks".
Actual terminal only displays asterisks, no values shown.
Terminal output at seconds 31-33.
No counterexamples were found in the test range ; the program only outputs `**********`.
Terminal output contains no values, only the loop end marker `**********`.
The screen shows a dark-background document page titled "Recurrence Formula for the Greatest Common Divisor of Two Numbers".
The page sequentially displays the core formula, 1.1 Subtraction Method, and 1.2 Euclidean Algorithm.
The mouse moves near the formulas and selects parts of the text.
Title "Recurrence Formula for the Greatest Common Divisor of Two Numbers".
Formula .
Subsection "1.1 Subtraction Method".
Formula .
Subsection "1.2 Euclidean Algorithm".
Formula .
The instructor explains from the general formula to the two special cases.
The mouse points to text around the formulas.
All three formulas involve .
The document structure remains a general formula plus two subsections.
The screen presents both the Subtraction Method and the Euclidean Algorithm as special cases of the same integer recurrence formula.
The screen switches to a code editor displaying a C++ program.
The code includes `#include <bits/stdc++.h>`, `using namespace std;`, `signed main()`, `const int ;`, `const int ;`, and `cout << gcd(a, b) << endl;`.
The terminal on the right shows compilation commands and output `24`.
The instructor types code in the editor, runs the program, and continues adding `const int c = gcd(a, b);` and `for (int ;k<=1024;++k)`.
A filename error prompt for `g++ aa.cpp` appeared once in the terminal, then changed to `.cpp && ./a.out`; this detail does not affect the gcd example result.
C++ source code editing area.
Terminal output area.
Variables `a`, `b`, `c` and loop variable `k`.
Function call `gcd(a, b)`.
Code changes from no output statement to calling `gcd(a,b)`.
Terminal changes from empty or error state to outputting `24`.
Later adds variable `c` and loop `for (int ;k<=1024;++k)`.
Example values remain , .
The core demonstration object is the calculation of `gcd(a,b)`.
The screen uses actual program execution to verify and begins converting the abstract parameter into an enumerable integer loop.
Left side VS Code editor shows C++ code; Right side terminal shows `$ .cpp && ./a.out` and output `**********`
From seconds 0-26, code is gradually completed: first `gcd(b, )` appears, then wrapped in `if (c != ...)`, followed by adding `cout << k << endl;`, finally adding `cout << "**********" << endl;`
VS Code editor
Terminal window
C++ code
Compilation command
Program output
Code completes from syntactically incorrect `gcd(b, )` to `if (c != gcd(b, ))`
Loop body adds `cout << k << endl;`
End of program adds `cout << "**********" << endl;`
Terminal changes from old output `24` to recompiled `**********`
Variables , remain unchanged
Loop range to remains unchanged
The screen demonstrates no counterexamples in the test range by enumerating and only printing when the equality fails, with the terminal outputting only asterisks.
At second 48, switches to black-background white-text lecture, title "1 Recurrence Formula for GCD of Two Numbers", text "For any integer : "
After second 69, sections 1.1 "Subtraction-based Algorithm" and 1.2 "Euclidean Algorithm" and their formulas are visible
At seconds 99-107, formula receives the pink handwritten annotation above it, with an arrow pointing to below.
Lecture title
General recurrence formula
Subtraction-based algorithm section
Euclidean algorithm section
Pink handwritten annotation
Arrow
Page switches from code environment to lecture
Narrator writes in pink pen on the second argument of the general formula
Arrow connects this expression to
General formula always appears as the parent formula
Two special cases correspond to and respectively
Visual annotations concretize in the general recurrence as the remainder , illustrating that the Euclidean algorithm is a substitution special case of the general formula.
The instructor says "I directly used the gcd function here because my C++ version is relatively new now, so it comes with the gcd function built-in."
The instructor continues "But during exams, the C++ compiler version might not be this new, so you may need to implement the gcd function yourself during exams."
Assuming all C++ exam environments can use the `gcd(a,b)` function just because it is called directly in the demo.
The video explicitly reminds that the demo environment has a newer C++ version, but exam compilers might be older, requiring manual implementation of `gcd`.
The narrator says "You will find that this program only outputs a bunch of asterisks, right? Understandable, that is to say, for any , gcd a b equals gcd b a minus times , always holds"
Terminal only shows `**********`, no displayed
Seeing only asterisks in the terminal might lead one to mistakenly believe the program did not perform gcd comparisons.
The video code is designed to output the corresponding only when `c != gcd(b, )`; no output and only trailing asterisks indicates no counterexamples were found in the test range.
The document first gives the core formula, then writes "Let , to get the Subtraction Method".
The Subtraction Method is a special case of the core recurrence formula with .
The document first gives the core formula, then writes "Let , to get the Euclidean Algorithm".
The Euclidean Algorithm is a special case of the core recurrence formula with .
The code calls `gcd(a,b)` to calculate the example value.
The instructor first explains the gcd recurrence formula, then gives an example calculating .
The video does not show the complete process of manually applying the recurrence formula, but uses the library function directly.
The example demonstrates greatest common divisor calculation with specific values, echoing the previous topic about gcd formulas.
The instructor says the demo environment can use `gcd` directly, but exams might require self-implementation.
The video contrasts "directly calling the existing `gcd` function" with "needing to understand and implement the gcd recurrence method manually".
Lecture section 1 general formula ; Section 1.1 "Let , we get the subtraction-based algorithm: "
The subtraction-based algorithm is a special case of the recurrence formula when .
Lecture section 1 general formula ; Section 1.2 "Let , we get the Euclidean algorithm: "
The Euclidean algorithm is a special case of the recurrence formula when .
Code enumerates and checks `c != gcd(b, )`; Terminal only outputs `**********`
Narrator infers from "only output a bunch of asterisks" that "For any ... always holds"
Code only verifies finite range , narrator verbally generalizes to any integer
The code example is used to support the proposition of gcd invariance for any integer .
The document title and core formula are visible.
The document writes "Let , to get the Subtraction Method".
The document writes "Let , to get the Euclidean Algorithm".
The code sets ``, ``, and the terminal outputs `24`.
The instructor explains that `gcd` can be used directly because the C++ version is new, and warns that exams might require self-implementation.
Lecture section 1 "For any integer : "
Terminal only outputs `**********`
Narrator explains "only output a bunch of asterisks" means no causes the equality to fail
Lecture section 1.1 "Let , we get the subtraction-based algorithm: "
Lecture section 1.2 "Let , we get the Euclidean algorithm: "
Handwritten annotation points to
Covered · Document view and narration cover the core gcd recurrence formula and its two special cases.
Covered · Code editor and terminal demonstrate the numerical result of `gcd(24,504)` and discuss limitations of using C++ built-in `gcd`.
Covered · Code writing, compilation execution, and terminal output verify gcd recurrence invariance.
Covered · Lecture presents the recurrence formula for the greatest common divisor of two numbers.
Covered · Lecture presents the subtraction-based algorithm as a special case for .
Covered · Lecture and handwritten annotations present the Euclidean algorithm as a special case for k=⌊⌋.
From 38 to 175 seconds, the C++ example computes gcd(24,504)=24 and tests gcd(504,) for integer k from -1024 through 1024. The terminal reports no counterexample in that finite range; the public review explicitly says this finite test is not a universal proof.
From 175 to 254 seconds, the source states gcd(a,b)=gcd(b,a-kb), sets for the subtraction method, then sets k=floor() and visually connects a-floor()b to a mod b, yielding gcd(a,b)=gcd(b,a mod b). The review records the missing b!=0 and remainder-convention boundary, so this is explanation rather than proof.