谢谢,Mico!
\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
$f\colon\mathbb{Z}\to\mathbb{N}$ is more correct than
$f\colon\mathbb{Z}\mapsto\mathbb{N}$.
\begin{align}
f\colon\mathbb{Z}&\to\mathbb{N}\notag\\
n&\mapsto \left( n\mod 3\right)^2
\end{align}
\end{document}