Finding a primitive explicitly

Let $A=\{z\in\mathbb{C}~:~|z|>4\}$. Let $f(z)=\frac{z}{(z-1)(z-2)(z-3)}$ and $g(z)=\frac{z^2}{(z-1)(z-2)(z-3)}$.

I have been asked whether or not $f$ and $g$ have global primitives in $A$ and if so to find them.

After decomposing into partial fractions I have:

$f(z)=\frac{1}{2}\bigg(\frac{1}{z-1}\bigg)-2\bigg(\frac{1}{z-2}\bigg)+\frac{3}{2}\bigg(\frac{1}{z-3}\bigg)$

and

$g(z)=\frac{1}{2}\bigg(\frac{1}{z-1}\bigg)+-4\bigg(\frac{1}{z-2}\bigg)+\frac{9}{2}\bigg(\frac{1}{z-3}\bigg)$.

Now my understanding of the complex logarithm is not great, but from what I understand, in any simply connected open subset of $\mathbb{C}-{a}$ there is a branch of $\log(z-a)$ serving as a primitive for $\frac{1}{z-a}$. However our region $A$ is not simply connected. How can we work around this?

Thanks for any advice and/or deeper insights into understanding primitives involving logs/mulitivalued functions.

$\bf{UPDATE:}$ Thanks to zyx's answer, I have made the following realization. To show the existence of a primitive for a given function in the domain $A$, I just need to show that the integral around every closed loop in $A$ evaluates to 0. For loops which wind around the complement of $A$, this only happens when the coefficients of the $\frac{1}{z-a}$ terms sum to 0, as hinted below.

However I still do not really understand why we can say the primitive $\frac{1}{2}\log(z-1)-2\log(z-2)+\frac{3}{2}\log(z-3)$ is well defined in $A$.

-

The hint by zyx is a good one. But you can also make the quick observation that the path integrals of $f$ and $g$ along a circle of radius $R$ around the origin does not depend on $R$ in the interval $R>4$. Now let $R\to\infty$. Far away from the origin $f(z)$ is close to $1/z^2$, so the limit of this path integral as $R$ grows is ... Far away from the origin $g(z)$ is close to $1/z$, so...

Edit(ver3 - the previous two edits were not very clear, sorry): Another way of seeing the same thing would be to think about it on the Riemann sphere. The goal is to show that the condition in zyx's answer is satisfied. The key is to identify the constants $p,q,r$ as residues of $f(z)\,dz$ at the respective poles.

Both $f$ and $g$ have limit zero at infinity, so they are defined and holomorphic at infinity. So switch to the variable $w=1/z$. Now $f(z)\,dz=f(1/w)\cdot(-1/w^2)\,dw$, similarly for $g$. On the $w$-plane your region $A$ consists of the points with $|w|<1/4$. We see that $$f(1/w)\frac1{w^2}=\frac{(1/w)(1/w^2)}{(-1+1/w)(-2+1/w)(-3+1/w)}=\frac1{(1-w)(1-2w)(1-3w)}$$ is holomorphic in $A$.

Therefore the path integral of $f(1/w)w^{-2}\,dw$ along a circle $|w|=1/R, R>4$ is zero. But this path integral is equal (up to sign) to the path integral of $f(z)\,dz$ along the circle $|z|=R$. Therefore the latter path integral is also zero. But this means that the sum of the residues of $f(z)$ at its poles is also equal to zero, so zyx's condition will be satisfied, and we can conclude that $f(z)$ has a primitive in $A$.

OTOH with $g(1/w)w^{-2}$ things don't go quite as well. All because the degrees of numerator and denominator ____ (fill in the blank)

============================

Remark: The piece of general theory I am aiming at here is that for any rational function $f(z)=P(z)/Q(z)$ the sum of the residues of $f(z)\,dz$ over the Riemann sphere is always zero. Here the residue at infinity is defined by switching to the local parameter $w=1/z$ and studying the form $f(1/w)\,d(1/w)=-f(1/w)w^{-2}\,dw$ at $w=0$. This (well-known result) follows from the fact that a suitable large circle loops once counterclockwise around all the finite poles. The above substitution $w=1/z$ turns the tables in the sense that the finite poles are now outside, and an eventual pole at $w=0$ is the only residue affecting this modified path integral - with the path now looping clockwise. Taking the sign change (due to switch in orientation of the loop) into account gives the result.

The rest of the calculations were about showing that if $\deg P(z)\le\deg Q(z)-2$, then the residue at infinity is zero. Hence the sum of the residues at the finite poles also has to be zero. The extra $-2$ comes from the need to switch local variables. Going deeper we could also say that $-2(\infty)$ is a canonical divisor of the rational function field, but let's stop here :-)

Edit $\#n$: Still there were typos. Switching to CW.

-
I can use the estimate that the integral around the circle $C_R$ of radius $R$ is bounded by $M(R)\cdot 2\pi R$, where $M(R)$ is the max of the modulus of the function on $C_R$. So the integral of $f$ would go to 0, $g$ to $2\pi$. But how can I formalize that $f$ goes to $1/z^2$ so I don't have to actually find $M(R)$? Or would $M(R)$ always occur at the real number $R$? (for $R>4$) – RHP Aug 14 '11 at 8:16
@RHP: Good! That's what I was hinting. You don't need to find $M(R)$ explicitly. It suffices to observe that for $R>4$ all the factors in the denominator have absolute values at least $R/4$. Because $1,2,3 < 3|z|/4$, the triangle inequality gives you that much. Then you can tell that for $f$ you have $M(R)<K/R^2$ for some constant $K>0$. – Jyrki Lahtonen Aug 14 '11 at 8:21
Thanks so much! – RHP Aug 14 '11 at 8:27

$p \log(z-1) + q \log(z-2) + r\log(z-3)$ is well-defined in the region A when $p+q+r=0$.

-