(gcd; greatest common divisor) I am pulling a night shift because I have trouble understanding the following task.
Fibonacci is defined by this in our lectures:
I) $F_0 := 1$ and $F_1 := 1$
II) For $n\in\mathbb{N}$, $n \gt 1$ do $F_n=F_{n-1}+F_{n-2}$
Task
Be for n>0 the numbers $F_n$ the Fibonacci-numbers defined as above.
Calculate for $n\in\{3,4,5,6\}$ $\gcd(F_n, F_{n+1})$ and display it as
aFₙ + bFₙ₊₁
, that means find numbers a, b, so that
gcd(Fₙ, Fₙ₊₁) = aFₙ + bFₙ₊₁
holds.
I know how to use the Euclidian Algorithm, but I don't understand from where I should find the a and b from, because the task gives me {3,4,5,6} and every gcd in this gives me 1. (gcd(3,4)=1 ; gcd(4,5)=1) I need help solving this as I am hitting a wall.
What you need here is the so-called Extended Euclidean Algorithm where you back substitute to calculate numbers $a$ and $b$ such that $aF_n + bF_{n+1} = \gcd(F_n,F_{n+1})$. For example, let's use $F_3 = 3$ and $F_4 = 5$, Then
$$ 5 = 1\cdot3 + 2 $$ $$ 3 = 1\cdot2 + 1 $$
Rearranging and substituting gives
$$ 2 = 5 - 3 $$ $$ 3 = (5 - 3) + 1$$
Which gives
$$ 2\cdot 3 - 5 = 1$$
That is
$$ 2F_{3} + (-1) F_4 = 1$$