In RSA clock arithmetics is used, and as Fermat's little theorem says, a^p mod p = a. The exponentiation is cyclical, a^x = a^(x mod p-1) (mod p), the same sequence of numbers is repeated in each cycle. Is there in a similar way a cycle for all modular exponentiation, or, only for some cases like prime modulo?