\documentclass{article}
\usepackage{amsmath, amssymb,verbatim, amsthm, graphicx}

%exercise environment
\newcounter{exercise}
\setcounter{exercise}{0}
\newenvironment{exercise}{\addtocounter{exercise}{1} \noindent{\bf{Exercise \theexercise.}}}{\vspace{.5cm}}

\newcommand{\Z}{\mathbb{Z}}


\textwidth 6.5in
\textheight 9in
\oddsidemargin 0in
\evensidemargin 0in
\headsep -0.5in

\setlength{\parskip}{0.25cm}

\pagenumbering{gobble}

\begin{document}


\noindent{\Large{\textsc{Number Theory \hfill Assignment $n$  \\ Spring 2022 \hfill Your Name}}}

\large

\vspace{1cm}

\begin{exercise}
Prove that if $n \in \Z$ is odd, then $n^2 - 1$ is divisible by 8.
\end{exercise}

\begin{proof}[Solution.]
If $n$ is odd, then both $n+1$ and $n-1$ are even.  Furthermore, either $n \equiv 1 \pmod 4$ or $n \equiv -1 \pmod 4$.  In the first case we have $4 | (n-1)$ and $2 | (n+1)$, so that $8 | (n-1)(n+1) = n^2 - 1$.  In the second case $4 | n + 1$ and $2 | n - 1$ so that we again have $8 | (n+1)(n-1) = n^2 - 1$.
\end{proof}


\end{document}
