Problem 549: (2001 AIME II, 1)
Let $N$ be the largest positive integer with the following property: reading from left to right, each pair of consecutive digits of $N$ forms a perfect square. What are the leftmost three digits of $N$?
- The two-digit squares are $16,25,36,49,64,81$. As arrows between digits: $1\to6$, $2\to5$, $3\to6$, $4\to9$, $6\to4$, $8\to1$.
- Each digit has at most one arrow out, so a number with the property is a path in this graph. There is no cycle, and the longest path is $8\to1\to6\to4\to9$.
- The longest such number, which is also the largest, is $N=81649$. Its leftmost three digits are $816$.
- The answer is $\boxed{816}$.
Let $N$ be the largest positive integer with the following property: reading from left to right, each pair of consecutive digits of $N$ forms either a perfect square or a multiple of $29$. What are the leftmost three digits of $N$?