From b8f83987b190e282fd25c24e1c251678ad757765 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 27 Jul 2016 03:58:35 +0200 Subject: Add exercice: [▶10] Modular powers of 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- doc/exercises.tex | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'doc/exercises.tex') diff --git a/doc/exercises.tex b/doc/exercises.tex index e004f0a..83b79f8 100644 --- a/doc/exercises.tex +++ b/doc/exercises.tex @@ -38,6 +38,14 @@ which calculates $r = a \dotminus b = \max \{ 0,~ a - b \}$. +\item {[$\RHD$\textit{10}]} \textbf{Modular powers of 2} + +What is the advantage of using \texttt{zmodpow} +over \texttt{zbset} or \texttt{zlsh} in combination +with \texttt{zmod}? + + + \item {[\textit{M10}]} \textbf{Convergence of the Lucas Number ratios} Find an approximation for @@ -219,6 +227,15 @@ void monus(z_t r, z_t a, z_t b) \end{alltt} +\item \textbf{Modular powers of 2} + +\texttt{zbset} and \texttt{zbit} requires $\Theta(n)$ +memory to calculate $2^n$. \texttt{zmodpow} only +requires $\mathcal{O}(\min \{n, \log m\})$ memory +to calculate $2^n \text{ mod } m$. $\Theta(n)$ +memory complexity becomes problematic for very +large $n$. + \item \textbf{Convergence of the Lucas Number ratios} -- cgit v1.2.3-70-g09d2