Problem

Source: Moldova 2000 Grade 12 P3

Tags: algebra



For any $n\in\mathbb N$, denote by $a_n$ the sum $2+22+222+\cdots+22\ldots2$, where the last summand consists of $n$ digits of $2$. Determine the greatest $n$ for which $a_n$ contains exactly $222$ digits of $2$.