Solution 622d13a7-cfb4-4a3a-bde9-e725dd44beb0

Points: 2 pts

We can let $i^2$ and $j^2$ be the larger and smaller squares,
respectively, with integers $i\ge j\ge0$, to obtain
\[
\begin{aligned}
i^2&=M+3773,\\
j^2&=M+1213.
\end{aligned}
\]
Taking the difference and sum of the two equations, we find
\[
\begin{aligned}
i^2-j^2&=2560,\\
i^2+j^2&=2M+4986.
\end{aligned}
\]
We see that $M=-1213+j^2$, meaning
\[
\text{maximize }M\quad\Longleftrightarrow\quad\text{maximize }j.
\]
Since $i^2-j^2$ is even, we also have $i\equiv j\pmod{2}$.
As $i>j$, the closest possible roots satisfy $j=i-2$; in general,
$i\ge j+2$. Substituting this bound gives
\[
2560=i^2-j^2\ge(j+2)^2-j^2=4j+4,
\]
so $j\le639$. Equality is attained when $j=i-2$, giving
\[
j=639\equiv-1\pmod{10},\qquad i=641\equiv1\pmod{10}.
\]
Working directly modulo $10$, we find
\[
M=-1213+j^2\equiv-3+(-1)^2\equiv8\pmod{10}.
\]
Its units digit is therefore $8$.

Final answer:
8