\documentclass{article}
\input{preamble}
\usepackage{ mathdots }
\title{Tetration Truncation - MathGames}

\begin{document}

\maketitle
{\bf Difficulty:} \stars{2}\\
{\bf Key words: Tetration, Number Theory} \\

Tetration is a binary operator based on repeated exponentiation. It is often denoted as $$a \uparrow \uparrow n := a^{a^{\iddots^a}},$$ where the tower of exponents contains $n$ copies of $a$. For example, $2 \uparrow \uparrow 3 = 2^{2^2} = 2^4 = 16$. The problem with explicitly computing tetration is that even for small $a$ and $n$, the tetration $a \uparrow \uparrow n$ can become very large: the tetration $3 \uparrow \uparrow 4$ already has $3638334640025$ digits. In this problem, we are interested in computing the last few digits of otherwise infeasible tetrations.
\vspace{0.5cm}

{\Large \textbf Input}
\begin{itemize}
    \item Three space-separated integers $1 \leq a, n, k \leq 10^2$ with $\gcd (a, 10) = 1$.
\end{itemize}

{\Large \textbf Output}
\begin{itemize}
    \item A string containing the last $k$ digits of $a \uparrow \uparrow n$, including any leading zeroes.
\end{itemize}


{\Large \textbf Examples}\\
\begin{center}
\scalebox{1.5}{
\begin{tabular}{|l|l|}
\hline
Input & Output \\ \hline
2 3 3 & 016\\\hline
\end{tabular}
}

\vspace{1em}

\scalebox{1.5}{
\begin{tabular}{|l|l|}
\hline
Input & Output \\ \hline
3 4 2 & 87\\\hline
\end{tabular}
}
\end{center}


\end{document}