Analysis of Modular Arithmetic