Let $X$ be an affine variety and $f,g\in \mathcal{O}(X)$ such that $\lbrace f=0\rbrace = \lbrace g= 0\rbrace$. How does it follow by the Nullstellensatz that $f^n = g^m$ for some $m,n\in \mathbb{N}$? This is claimed in a proof, but I don't see the reason.
If it is not true in general, are there additional conditions under which the statement is true?
Many thanks in advance!