Dynamical systems and number theory