\documentclass[answers,addpoints,12pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{datetime}
\usepackage{listings}
\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,decorations.pathmorphing,backgrounds,positioning,fit}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{fontspec}
\IfFontExistsTF{Gentium Book Basic}{
  \setmainfont{Gentium Book Basic}
}{
  \setmainfont{Times New Roman}
}
\IfFontExistsTF{Comic Code}{
  \setmonofont{Comic Code}[
  Scale = 0.85,
  ]
}{
}
\setsansfont{Trebuchet MS}
\lstset{
  basicstyle=\ttfamily,
}

\DeclareMathOperator{\limplies}{\Rightarrow}
\DeclareMathOperator{\lbiconditional}{\Leftrightarrow}
\DeclareMathOperator{\liff}{\iff}
\DeclareMathOperator{\lxor}{\oplus}
\DeclareMathOperator{\qeq}{\overset{?}{=}}
\DeclareMathOperator{\modulus}{\mathbf{mod}}
\DeclareMathOperator{\even}{even}
\DeclareMathOperator{\odd}{odd}
\DeclareMathOperator{\ddiv}{|}
\DeclareMathOperator{\ndiv}{\not|}
\DeclareMathOperator{\contra}{\Rightarrow\mskip-\thinmuskip\Leftarrow}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\renewcommand{\P}[1]{\mathbb{P}(#1)}
\newcommand{\mathcheckmark}{\text{ \ding{51}}}

\DeclareMathOperator{\vowel}{vowel}
\DeclareMathOperator{\consonant}{consonant}
\DeclareMathOperator{\isprime}{prime}
\DeclareMathOperator{\equals}{equals}
\DeclareMathOperator{\divides}{divides}

% classname
\newcommand\examNumber{Sum And Numbers}
\newcommand\semester{Spring 2024}
\newcommand\className{Foundations of Computing}
\newcommand\classNumber{CIS~300}
\newcommand\classFullName{\classNumber~\className}
\renewcommand{\dateseparator}{-}
\yyyymmdddate

% /classname

\pagestyle{headandfoot}
\firstpageheader{\classFullName\\\semester}{\examNumber\\~}{\today\\~}
\runningheader{\examNumber}{}{\today}
\firstpagefooter{Page \thepage\ of \numpages}
              {}
              {Points earned: \makebox[.5in]{\hrulefill}\\
                 out of a possible \pointsonpage{\thepage} points}
\runningfooter{Page \thepage\ of \numpages}
              {}
              {Points earned: \makebox[.5in]{\hrulefill}\\
                 out of a possible \pointsonpage{\thepage} points}



\begin{document}
\pointsinrightmargin{}
\begin{questions}
\question{} You have see a great number of \emph{symbols} in lecture
  already. Two of them are $\in$ and $\ni$. Which of these symbols is
  to be read ``such that''?
  \begin{solution}[0.0in]

    $\in$ - reads as ``in'' or ``is a member of'' with a set: $7 \in \mathbb{Z}$\\
    $\ni$ - reads as ``such that'': $even(x)$ means there exists $y
    \in \mathbb{Z}$ $\ni$ $2y = x$
  \end{solution}

\question{} \textbf{Expand} each of the following by writing out
  \emph{all} of the terms with appropriate operators between them.
  \begin{multicols}{2}
  \begin{parts}
  \part{} $\sum\limits_{i=1}^{4} 10 \times i$
    \begin{solution}[0.0in]

      $10 \times 1 + 10 \times 2 + 10 \times 3 + 10 \times 4$\\
      $10 + 20 + 30 + 40 = 100$
    \end{solution}
  \part{} $\sum\limits_{j=3}^{5} j^2$
    \begin{solution}[0.0in]

      $3^2 + 4^2 + 5^2$\\
      $9 + 16 + 25 = 50$
    \end{solution}
  \part{} $\sum\limits_{k=100}^{104} k \mod 3$
    \begin{solution}[0.0in]

      {\small
      $(100 \mod 3) + (101 \mod 3) + $\\
      $(102 \mod 3) + (103 \mod 3) + $\\
      $(104 \mod 3)$\\}
      $1 + 2 + 0 + 1 + 2 = 6$
    \end{solution}
  \part{} $\sum\limits_{p=4}^{4} 2^p$
    \begin{solution}[0.0in]

      $2^4$\\
      $16$
    \end{solution}
  \part{} $\sum\limits_{q=0}^{3} 2^q$
    \begin{solution}[0.0in]

      $2^0 + 2^1 + 2^2 + 2^3$\\
      $1 + 2 + 4 + 8 = 15$
    \end{solution}
  \part{} $\prod\limits_{r=1}^{4} r + 1$
    \begin{solution}[0.0in]

      $(1 + 1) \times (2 + 1) \times (3 + 1) \times (4 + 1)$\\
      $2 \times 3 \times 4 \times 5 = 120$
    \end{solution}
  \part{} $\prod\limits_{s = 1}^{6} 10^s$
    \begin{solution}[0.0in]

      $10^{1} \times 10^{2} \times 10^{3} \times 10^{4} \times 10^{5}
      \times 10^{6}$\\
      $10^{\sum\limits_{i = 1}^6 i} = 10^{21}$
    \end{solution}
  \part{} $\prod\limits_{t = 1}^{3} t \cdot 2$
    \begin{solution}[0.0in]

      $(2 \cdot 1) \times (2 \cdot 2) \times (2 \cdot 3)$\\
      $2 \times 4 \times 6 = 48$
    \end{solution}
  \end{parts}
\end{multicols}

\question{} Calculate the result for each of the sums and products in
  the previous question.
  \begin{solution}[0.0in]

    See above.
  \end{solution}

\question{} What is the \emph{difference} between 1.(e) and 1.(d)?
  \begin{solution}[0.0in]

    $2^4 - (2^0 + 2^1 + 2^2 + 2^3) = 1$

  \end{solution}

\question{} Given what you know about the symbol $\in$, calculate the
  following value: $1 + \prod\limits_{p \in \{2, 3, 5, 7\}}p$
  \begin{solution}[0.0in]

    $1 + (2 \times 3 \times 5 \times 7) = 211$
  \end{solution}

\question{} Why does the product in the previous question not
  \emph{need} an ``upper'' bound?
  \begin{solution}[0.0in]

    The ``sequence'' of multiplicands comes from the listed elements
    of the set. It is not counting but rather taking on each value
    between the curly braces.
  \end{solution}
\question{} Is the answer to 5. above divisible by \emph{any} of the
  primes in the set used for the product?
  \begin{solution}[0.0in]

    No. Each leaves a remainder of 1.
  \end{solution}

\question{} Evaluate each of the following expressions. Pay careful
  attention to the \emph{type} of each of your answers.
  \begin{multicols}{2}
  \begin{parts}
  \part{} $17 \ddiv 51$
    \begin{solution}[0.0in]

      \textbf{Boolean}: true\\
      ($\ddiv$ is ``divides'')
    \end{solution}
  \part{} $144 \mod 41$
    \begin{solution}[0.0in]
      \textbf{Integer}: 21\\($3 \times 41 = 123 + 21 = 144$)\\
    \end{solution}
  \part{} The \emph{greatest common divisor} of \\288 and 84
    \begin{solution}[0.0in]

      \textbf{Integer}: 12
    \end{solution}
  \part{} $v^5 \cdot v^8$
    \begin{solution}[0.0in]

      \textbf{Same as $v$}: $v^{13}$
    \end{solution}
  \part{} $ 18 \ndiv 88$ (What do you \emph{think} it means?)
    \begin{solution}[0.0in]

      \textbf{Boolean}: not ($18 \ddiv 88$) = not (false) = true
    \end{solution}
  \part{} $\frac{w^{71}}{w^{75}}$
    \begin{solution}[0.0in]

      \textbf{Same as $w$}: $\frac{1}{w^4}$
    \end{solution}
  \end{parts}
  \end{multicols}
\question{} What is the \emph{definition} of the \emph{divides}
  predicate? That is: \textbf{Define} $a \ddiv b$. (Either definition
  presented in class is acceptable.)
  \begin{solution}[0.0in]

    $a \ddiv b$ ::= $b \mod a = 0$ \emph{-or-}\\
    $a \ddiv b$ ::= there exists an integer, $k$, such that $ak = b$
  \end{solution}

\end{questions}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
