5. Let $A$ be the set of all integer sequences. Find all $f: A \rightarrow \mathbf{Z}$ such that for any $x, y \in A$, we have $f(x+y)=f(x)+f(y)$.
(Zheng Jiu)
5. $f\left(x_{1}, x_{2}, \cdots, x_{n}, \cdots\right)=\sum_{i=1}^{n} a_{i} x_{i}$.

It is easy to verify that such an $f$ satisfies the conditions.
Next, we prove that all functions $f$ that satisfy the conditions must have the given form.
Let $e_{n}$ be the sequence with 1 in the $n$-th position and 0 elsewhere.
Let $f\left(e_{n}\right)=a_{n}$, and
$$
g\left(x_{1}, x_{2}, \cdots, x_{n}, \cdots\right)=f(x)-\sum_{i=1}^{n} a_{i} x_{i} .
$$

By the construction of $g$, we know that it satisfies
$$
g(x+y)=g(x)+g(y),
$$

and if $x$ has only finitely many non-zero terms, then $g(x)=0$.
It remains to prove that for all $x \in A$, we have
$$
g(x)=0 \text {. }
$$

Let $x=\left\{x_{n}\right\}$.
By Bézout's theorem, there exist sequences $y=\left\{y_{n}\right\}$ and $z=$ $\left\{z_{n}\right\}$, such that for all positive integers $n$, we have
$$
x_{n}=2^{n} y_{n}+3^{n} z_{n} \text {. }
$$

Thus, $g(x)=g(y)+g(z)$.
To prove $g(x)=0$, it suffices to prove $g(y)=g(z)=0$.
Since for all sequences $x$ with finitely many non-zero terms, we have $g(x)=0$, thus, for any positive integer $n$, we have
$$
\begin{array}{c}
g(y)=g\left(y_{1}, \cdots, y_{n-1}, 0, \cdots, 0\right)+ \\
g\left(0, \cdots, 0, y_{n}, \cdots\right) \\
=g\left(0, \cdots, 0, y_{n}, \cdots\right) \\
=2^{n} g\left(0, \cdots, 0, \frac{y_{n}}{2^{n}}, \frac{y_{n+1}}{2^{n}}, \cdots\right)
\end{array}
$$

is divisible by $2^{n}$.
Hence, $g(y)=0$.
Similarly, $g(z)=0$.
Therefore, $g$ is identically zero.
Thus, $f\left(x_{1}, x_{2}, \cdots, x_{n}, \cdots\right)=\sum_{i=1}^{n} a_{i} x_{i}$.