Answer
$$ f(x,y,z)=x+3y+z+K $$
Work Step by Step
Given $$\nabla f=\langle 1, 3,1\rangle$$
Since $$ \nabla f=\left\langle\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right\rangle=\langle1, 3,1\rangle$$
Then
\begin{align*}
\frac{\partial f}{\partial x}&=1\ \ \ \Rightarrow\ \ f=x+C_1\\
\frac{\partial f}{\partial y}&=3\ \ \ \Rightarrow\ \ f=3y+C_2\\
\frac{\partial f}{\partial z}&=1\ \ \ \Rightarrow\ \ f=z+C_3\\
\end{align*}
Hence
$$ f(x,y,z)=x+3y+z+K $$