$$P(a, b): f(ab) = f(a) + f(b) + kf(\gcd(a,b))$$Plugging $P(a, a)$: $$f(a^2) = (k+2) f(a).$$Notice that: $$f(a^4) = f(a^2)(k+2) = (k+2)^2 f(a)$$Also: $$f(a^4) = f(a^3)+f(a)+kf(a) = f(a^2)+2f(a)+k f(a) = (3k+4)f(a).$$Equating both of the above equations: $k=0, -1$.
Now, we will provide functions $f$ which satisfy the given conditions for the values of $k$:
For $k=0$: $f(p_1^{e_1} p_2^{e_2} \cdots ) = e_1 f(p_1) + e_2 f(p_2)+\cdots $ Thus, letting $f(1997)=1998$ works and rest of them to be zero works.
For $k=-1$: let $g$ be a function mapping from $\mathbb N$ to $\mathbb Z$ for which: $$f(p_1^{e_1} p_2^{e_2} \cdots ) = g(p_1)+g(p_2)+\cdots.$$Here we can let $g(1997)=1998$ and for all primes $p \neq 1997$: $g(p) = 0$
(we can do this thing in many other ways too ).