Problem

Source: Olimpiada Rioplatense 2013 Level 3, Problem 5.

Tags: number theory, greatest common divisor, modular arithmetic, algorithm, number theory proposed



Find all positive integers $n$ for which there exist two distinct numbers of $n$ digits, $\overline{a_1a_2\ldots a_n}$ and $\overline{b_1b_2\ldots b_n}$, such that the number of $2n$ digits $\overline{a_1a_2\ldots a_nb_1b_2\ldots b_n}$ is divisible by $\overline{b_1b_2\ldots b_na_1a_2\ldots a_n}$.