According to the GMP documentation here:
Function: unsigned long int mpz_remove (mpz_t rop, mpz_t op, mpz_t f)
Remove all occurrences of the factor f from op and store the result in rop. The return value is how many such occurrences were removed.
So the mpz_remove function should be able to be used to answer the titled question. At the moment my code looks like this:
mpz_set_ui(temp2,2);
mpz_remove(temp,K0,temp2);
which works fine, but the result I want is K0 divided by temp (and not temp itself) [which I could get by adding a subsequent division operation, but that seems wasteful].
How should I actually get K0/temp?