Does anybody here have any ideas why the following code does not seem to compile in MiKTeX 2.9? I am using the amsthm package:
$$\begin{align}
&1+(8 m - 2) (12 m + 1)^k + (48m^2 - 8 m + 1) (12 m + 1)^{2 k} \\
\\ &=1+(8 m - 2)\sum_{i=0}^{k}\binom{k}{i}(12m)^i + (48m^2 - 8 m + 1)\sum_{i=0}^{2k}\binom{2k}{i}(12m)^{i} \\
\\ &=1+(8 m - 2)\bigg(1+12km+\underbrace{\sum_{i=2}^{k}\binom{k}{i}(12m)^i}_{\text{divisible by $288m^2$}}\bigg)
\\ &\qquad\quad + (48m^2 - 8 m + 1)\bigg(1+24km+\binom{2k}{2}(12m)^{2}+\underbrace{\sum_{i=3}^{2k}\binom{2k}{i}(12m)^{i}}_{\text{divisible by $288m^2$}}\bigg) \\
\\ &\equiv 1+(8 m - 2)(1+12km)
\\ &\qquad\quad + (48m^2 - 8 m + 1)\bigg(1+24km+\binom{2k}{2}(12m)^{2}\bigg)\pmod{288m^2} \\
\\ &\equiv 48(k+1)m^2\pmod{288m^2}
\end{align}$$
I have confirmed that the code renders perfectly in MathJAX. However, in TeXnicCenter, it is spitting out the following error upon compile:
latex> ! Package amsmath Error: Erroneous nesting of equation structures;
latex> (amsmath) trying to recover with `aligned'.
latex> See the amsmath package documentation for explanation.
Please help.

$$, which is plain TeX syntax for a displayed equation, and shouldn't be used with LaTeX code. Also, note that MathJAX is not LaTeX. – Bernard Jul 11 '21 at 15:25