TITLE: Are there non-continuable functions that become continuable when raised to some power?
QUESTION [5 upvotes]: Let $X$ be a complex algebraic variety (integral, separated scheme of finite type over $\mathbb C$) and $U\hookrightarrow X$ an open subvariety. I will say that $f\in\mathscr O_X(U)$ is continuable if there exists some $g\in \mathscr O_X(X)$ with $g|_U=f$. My question is simply: Can it happen that $f$ is not continuable, but there exists a $k\in\mathbb N^+$ with $f^k$ continuable? 
I was debating with a friend who thinks it is possible but could not give an example, while I thought that it is impossible but wasn't able to give a satisfying proof. So, I'd be really glad if you could provide one of the two (that is, a simple example of such a phenomenon or a proof that it can not happen).

REPLY [2 votes]: This answer is a generalization of Martin's answer.
Claim: If $X$ is a normal complex algebraic variety, then any function $f\in \mathcal{O}_X(U)$ with $f^k$ continuable must be continuable too.
Proof:
Notice first that wlog we can choose $U:=\{x\in X:f\in\mathcal{O}_{X,x}\}$ to be the maximal open subset of $X$ such that $f|_U$ is regular. If $U\neq X$, by algebraic Hartog theorem $X\setminus U$ is of purely codimension $1$, which means $X\setminus U$ is a finite union of distinct prime Weil divisors $D_i$.
Since $f^k$ is regular on $X$, we have $\operatorname{ord}_{D_i}(f^k)\geq 0$, hence $\operatorname{ord}_{D_i}(f)=\operatorname{ord}_{D_i}(f^k)/k\geq 0$, which means $f\in \mathcal{O}_{X,\zeta_i}$, where $\zeta_i$ is the generic point of $D_i$. Therefore, $\zeta_i \in U\cap D_i=\emptyset$, we get a contradiction.
Edit: Actually here is a much simpler proof:
Suppose $X$ is covered by affine open subsets $U_j$, then $\mathcal{O}_X(U_j)$ is integrally closed by the normality of $X$. Since $f$ is regular at the generic point of $X$, $f$ belongs to the quotient field of $\mathcal{O}_X(U_j)$ for every $j$. Since $\mathcal{O}_X(U_j)$ is integrally closed and $f^k$ is regular on every $U_j$, so $f$ is also regular on every $U_j$, hence $f$ is regular on $X$.