4. There are two positive integers $a$ and $b$, the sum of their squares is 585, and the sum of their greatest common divisor and least common multiple is 87. Then $a+b=$ $\qquad$ .
4.33.

Let the required positive integers be $a<b$, and let $(a, b)=d$, then we have $a=d x, b=d y$, and $(x, y)=1$.
Thus, $[a, b]=d x y$. According to the problem, we have $\left\{\begin{array}{l}d^{2} x^{2}+d^{2} y^{2}=585, \\ d+d x y=87,\end{array}\right.$ which simplifies to $\left\{\begin{array}{l}x^{2}+y^{2}=\frac{585}{d^{2}}, \\ 1+x y=\frac{87}{d} .\end{array}\right.$
Since $585=3^{2} \times 5 \times 13$, and $d^{2} \mid 585$, we have $d=3$. Thus, $\left\{\begin{array}{l}x^{2}+y^{2}=65, \\ 1+x y=29,\end{array}\right.$ which leads to $\left\{\begin{array}{l}x+y=11, \\ x y=28 .\end{array}\right.$
Solving this, we get $x=4, y=7$.
Therefore, $a=3 \times 4=12, b=3 \times 7=21$.