2. Let $n \geq 3$ be an integer. Prove that for all integers $k$, with $1 \leq k \leq \binom{n}{2}$, there exists a set $A$ with $n$ distinct positive integer elements such that the set $B = \{\gcd(x, y): x, y \in A, x \neq y \}$ (gotten from the greatest common divisor of all pairs of distinct elements from $A$) contains exactly $k$ distinct elements.
Problem
Source: Question 2 - Brazilian Mathematical Olympiad 2017
Tags: number theory, greatest common divisor, combinatorics, Brazilian Math Olympiad, Brazilian Math Olympiad 2017