[Point](https://artofproblemsolving.com/wiki/index.php/Point) $B$ is in the exterior of the [regular](https://artofproblemsolving.com/wiki/index.php/Regular_polygon) $n$-sided polygon $A_1A_2\cdots A_n$, and $A_1A_2B$ is an [equilateral triangle](https://artofproblemsolving.com/wiki/index.php/Equilateral_triangle). What is the largest value of $n$ for which $A_1$, $A_n$, and $B$ are consecutive vertices of a regular polygon?
[1997 AIME-6.png](https://artofproblemsolving.com/wiki/index.php/File:1997_AIME-6.png)
Let the other regular polygon have $m$ sides. Using the interior angle of a regular polygon formula, we have $\angle A_2A_1A_n = \frac{(n-2)180}{n}$, $\angle A_nA_1B = \frac{(m-2)180}{m}$, and $\angle A_2A_1B = 60^{\circ}$. Since those three angles add up to $360^{\circ}$,
\begin{eqnarray*} \frac{(n-2)180}{n} + \frac{(m-2)180}{m} &=& 300\\ m(n-2)180 + n(m-2)180 &=& 300mn\\ 360mn - 360m - 360n &=& 300mn\\ mn - 6m - 6n &=& 0 \end{eqnarray*}
Using [SFFT](https://artofproblemsolving.com/wiki/index.php/Simon%27s_Favorite_Factoring_Trick), 
\begin{eqnarray*} (m-6)(n-6) &=& 36 \end{eqnarray*}
Clearly $n$ is maximized when $m = 7, n = \boxed{042}$.