\documentclass[12pt,oneside]{article}

\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage{enumitem}
\usepackage{fancyvrb}

%% comment out if you don't have MinionPro installed!
\usepackage[onlytext]{MinionPro}


\def\compare{ {\mathrm{compare}} }
\def\swap{ {\mathrm{swap}} }
\def\sort{ {\mathrm{sort}} }
\def\true{ {\mathrm{true}} }
\def\false{ {\mathrm{false}} }


%% \setlength{\topmargin}{-0.75in}
%% \addtolength{\textheight}{2.00in}
%% \setlength{\parindent}{0in}
\pagestyle{empty}

\begin{document}

\begin{center}
{\Large Lecture 04 Ticket}\hfill\emph{COSC 311: Algorithms}, Fall 2022
\end{center}

\vspace{0.25in}

\begin{minipage}{0.75\textwidth}
  \noindent{\large Name:}\ \hrulefill
  
\vspace{0.375in}

\end{minipage}

\noindent Consider the following method that on input a positive integer $n$ sums the \emph{odd} numbers from $1$ to $2 n - 1$:
\begin{Verbatim}[numbers=left]
Sum(n):
  total <- 0
  for k = 1 up to n do
    total <- total + 2 * k - 1
  endfor
  return total  
\end{Verbatim}
Observe that for $n = 1, 2, 3, 4$, $\mathrm{Sum}(n)$ returns the values $1, 4, 9, 16$. In each case, the value returned by $\mathrm{Sum}(n)$ is $n^2$. Use induction to argue that that this formula always holds: for every positive integer $n$, the value returned by $\mathrm{Sum}(n)$ is $n^2$.

\end{document}
