modulus recursion