Find all $t\in \mathbb Z$ such that: exists a function $f:\mathbb Z^+\to \mathbb Z$ such that:
$f(1997)=1998$
$\forall x,y\in \mathbb Z^+ , \text{gcd}(x,y)=d : f(xy)=f(x)+f(y)+tf(d):P(x,y)$
1. Let \( P(x, y) \) be the assertion \( f(xy) = f(x) + f(y) + t f(\gcd(x, y)) \).

2. Consider \( P(x, x) \):
   \[
   f(x^2) = f(x) + f(x) + t f(x) = (2 + t) f(x)
   \]
   This implies:
   \[
   f(x^2) = (2 + t) f(x)
   \]

3. Next, consider \( P(x, x^2) \):
   \[
   f(x^3) = f(x^2) + f(x) + t f(x) = (2 + t) f(x) + (1 + t) f(x) = (3 + 2t) f(x)
   \]
   This implies:
   \[
   f(x^3) = (3 + 2t) f(x)
   \]

4. Now, consider \( P(x, x^3) \):
   \[
   f(x^4) = f(x^3) + f(x) + t f(x) = (3 + 2t) f(x) + (1 + t) f(x) = (4 + 3t) f(x)
   \]
   This implies:
   \[
   f(x^4) = (4 + 3t) f(x)
   \]

5. Also, consider \( P(x^2, x^2) \):
   \[
   f(x^4) = f(x^2) + f(x^2) + t f(x^2) = (2 + t) f(x^2) = (2 + t) (2 + t) f(x) = (2 + t)^2 f(x)
   \]
   This implies:
   \[
   f(x^4) = (2 + t)^2 f(x)
   \]

6. Equating the two expressions for \( f(x^4) \):
   \[
   (4 + 3t) f(x) = (2 + t)^2 f(x)
   \]
   Since \( f(x) \neq 0 \) (as \( f(1997) = 1998 \neq 0 \)), we can divide both sides by \( f(x) \):
   \[
   4 + 3t = (2 + t)^2
   \]

7. Expanding and simplifying the equation:
   \[
   4 + 3t = 4 + 4t + t^2
   \]
   \[
   0 = t^2 + t
   \]
   \[
   t(t + 1) = 0
   \]

8. Solving for \( t \):
   \[
   t = 0 \quad \text{or} \quad t = -1
   \]

9. We need to check if these values of \( t \) satisfy the original conditions:
   - For \( t = 0 \):
     \[
     f(xy) = f(x) + f(y)
     \]
     This is a Cauchy functional equation, and the only integer solution is \( f(x) = k \cdot \log(x) \). However, since \( f(1997) = 1998 \), this does not fit.
   - For \( t = -1 \):
     \[
     f(xy) = f(x) + f(y) - f(\gcd(x, y))
     \]
     We can choose \( f(x) = 1998 \) for all \( x \), which satisfies \( f(1997) = 1998 \) and the functional equation.

Therefore, the only value of \( t \) that works is \( t = -1 \).

The final answer is \( \boxed{ t = -1 } \)