Fix bigint_is_prime via intermediate int result (RT #117731)