I'm looking for an algorithm that, given as input a polynomial $f \in \mathbb{Z}[x]$ and a prime number $p$, returns as output $\max_{n \in \mathbb{Z}} v_p(f(n))$ (which belongs to $\mathbb{N} \cup \{+\infty\}$), where $v_p(\cdot)$ is the $p$-adic valuation. In particular, note that the output is $+\infty$ if and only if $f$ has a root in $\mathbb{Z}_p$, so this algorithm would also be an effective method to check if a polynomial has a root in the $p$-adic integers.
I know the Hensel's lemma in the form: "If $x_0 \in \mathbb{Z}$ is such that $2v_p(f^\prime(x_0)) < v_p(f(x_0))$ then there exists a unique $\widetilde{x}_0 \in \mathbb{Z}_p$ such that $f(\widetilde{x}_0) = 0$ and $\widetilde{x}_0 \equiv x_0 \bmod p^{v_p(f^\prime(x_0)) + 1}$." but I have not been able to build such algorithm using it, so I guess other results are needed.
Thank you for any help