Define a vector field $\vec F$ in $\Bbb{R}^n \setminus 0$ by $\vec F(x)=\left \| x \right \|^px$, where $p$ is a real constant.
How to find a potential function for $\vec F$? Shall I just directly integrate this? or do this case by case and use induction?
Let $r = \|x\|$. Consider $g(r) := \frac{r^{p+2}}{p+2}$. We have $$\operatorname{grad}g(r) = \frac{x}{r}\frac{d}{dr}\left(\frac{r^{p+2}}{p+2}\right) = \frac{x}{r}(r^{p+1}) = r^{p}x = \vec{F}(x),$$
so $g$ is a potential for $\vec{F}$.
In general, when given $\vec{F}(x) = A(r)x$, where $A$ is a continuous function of $r$, here's how we can find a potential for $\vec{F}$. We seek $g = g(r)$ such that $\vec{F} = \operatorname{grad} g$. Now $\operatorname{grad}g = \frac{x}{r}g'(r)$, so we solve
$$\frac{x}{r}g'(r) = A(r)x.$$
Taking the dot product with $x$, we get
$$\frac{x\cdot x}{r}g'(r) = A(r)x\cdot x.$$
Since $x\cdot x = r^2$, the equation reduces to
$$g'(r) = A(r)r$$
Thus, a solution for $g$ is
$$g(r) = \int^r A(u)u\, du.$$