Whenever you have to do `integer(n.as_mpz())`, it's a sign that the `const Integer &n` needs to be changed to `const RCP<const Integer> &n`.