  We prove the existence of transcendental entire functions $f$ having a
property studied by Mahler, namely that $f(\overline{\mathbb{Q}})\subseteq
\overline{\mathbb{Q}}$ and $f^{-1}(\overline{\mathbb{Q}})\subseteq
\overline{\mathbb{Q}}$, and in addition having a prescribed number of
$k$-periodic algebraic orbits, for all $k\geq 1$. Under a suitable topology,
such functions are shown to be dense in the set of all entire transcendental
functions.
