Problem

Source: Czech-Polish-Slovak Junior Match 2017, individual p1 CPSJ

Tags: number theory, divisible, Digits, max



Find the largest integer $n \ge 3$ for which there is a $n$-digit number $\overline{a_1a_2a_3...a_n}$ with non-zero digits $a_1, a_2$ and $a_n$, which is divisible by $\overline{a_2a_3...a_n}$.