2. Given a positive integer $a$ such that the function
$$
f(x)=x+\sqrt{13-2 a x}
$$

has a maximum value that is also a positive integer. Then the maximum value of the function is $\qquad$ .
2.7.

Let $t=\sqrt{13-2 a x} \geqslant 0$. Then
$$
\begin{aligned}
y= & f(x)=\frac{13-t^{2}}{2 a}+t \\
& =-\frac{1}{2 a}(t-a)^{2}+\frac{1}{2}\left(a+\frac{13}{a}\right) .
\end{aligned}
$$

Since $a$ is a positive integer, $y_{\max }=\frac{1}{2}\left(a+\frac{13}{a}\right)$ is also a positive integer, so, $y_{\max }=7$.