Problem

Source: VII International Festival of Young Mathematicians Sozopol 2016, Theme for 10-12 grade

Tags: number theory, GCD, LCM, Sequence



We are given a non-infinite sequence $a_1,a_2…a_n$ of natural numbers. While it is possible, on each turn are chosen two arbitrary indexes $i<j$ such that $a_i \nmid a_j$, and then $a_i$ and $a_j$ are changed with their $gcd$ and $lcm$. Prove that this process is non-infinite and the created sequence doesn’t depend on the made choices.