Prime valuation (source code)

= Prime valuation
{title2=$v_p(n)$}
{wiki}

For a <prime number> $p$ and a <positive integer> $n$, the prime valuation is the exponent of $p$ in the <prime factorization> of $n$, equivalently
$$
v_p(n)=\max\{e\in\mathbb Z_{\geq0}:p^e\mid n\}.
$$
Thus $v_2(360)=3$ because $8$ divides $360$ but $16$ does not; $v_3(360)=2$, $v_5(360)=1$ and $v_7(360)=0$. In particular $v_p(1)=0$. <Multiplication> adds <prime valuations>, $v_p(ab)=v_p(a)+v_p(b)$, and the <fundamental theorem of arithmetic> makes comparison of <prime valuations> an exact test for <divisibility> between <positive integers>. This definition extends to a nonzero <integer> by taking its <absolute value>; for zero one commonly sets $v_p(0)=+\infty$.