I have a homework problem that I reuse relatively frequently, and I'm trying to update the solution to match the dynamic.
Suppose z(t) is a periodic function with period 3. Evaluate z(\the\year).
\begin{array}{c||c|c|c|c|c|c}
t &0 & 1 & 2 & 3 & \dotsb & \the\year\\
\hline
z(t) &12 & 5\pi & -6 & 12 & \dotsb & ??
\end{array}
Is there any clever coding that can be used to automatically compute \the\year mod3 and \ifthenelse the result?


\ifthenelseon that result. – D.J. Apr 12 '21 at 20:35\ifthenelse. With the non-negative output you can use\ifcaseinstead which has easier syntax than\ifthenelsefor this application. See https://tex.stackexchange.com/a/17678/119 – Willie Wong Apr 12 '21 at 20:41