$\newcommand{\lcm}{\operatorname{lcm}}$I am lost while following this explanation:
Let $$A(g, i) = \gcd(F_{g}, \lcm(F_{a_1}, F_{a_2}, \ldots , F_{a_i}))$$ and $$X = \lcm(F_{a_1}, F_{a_2}, \ldots , F_{a_{i - 1}})$$
Then $A(g, i) = \gcd(F_g, \lcm(X , F_{a_i}))$
Because GCD distributes over LCM, and vice versa (distributive lattice), we can write:
$$A(g, i) = \lcm(\gcd(F_{g}, F_{a_i}), \gcd(F_g, X)))$$
When I looked what distributed lattice mean, I was not able to find any connection to what I see here. Can anyone explain me what is going on here?
As dtldarek noticed in his comment, gcd and lcm define a distributive lattice on the set of positive natural numbers. This answer is just an expanded version of this comment.
Given two positive natural numbers $a$ and $b$, denote by $a \wedge b$ their gcd and by $a \vee b$ their lcm. Then you can verify that $$ (a \wedge b) \wedge c = a \wedge (b \wedge c) \quad \text{and} \quad (a \vee b) \vee c = a \vee (b \vee c) $$
$$ (a \wedge b) \vee c = (a \vee c) \wedge (b \vee c) \quad \text{and} \quad (a \vee b) \wedge c = (a \wedge c) \vee (b \wedge c) $$ For instance, taking $a = 18$, $b = 24$ and $c = 15$ in the second line, you get
and
Can you see now the connection with distributive lattices?