Do localization and completion commute?

Let $A$ be a commutative ring and $\mathfrak{p}$ be a prime ideal of $A$. Under which assumptions for $A$ and $\mathfrak{p}$ does localization by $\mathfrak{p}$ and completion with respect to $\mathfrak{p}$ commute? To be more precise,

when is $\widehat{A}_\widehat{\mathfrak{p}}$ (completion w.r.t. $\mathfrak{p}$) isomorphic to $\widehat{A_\mathfrak{p}}$ (completion w.r.t. $\mathfrak{p} A_\mathfrak{p}$)?

For example, is it true under the assumptions $A$ noetherian and $\mathfrak{p}$ a maximal ideal?

It seems to me that one important ingredient for a possible proof (under the right assumptions) is that localisation and building factor rings commutes. So a side question: Is it always true that $A_\mathfrak{p}/(\mathfrak{p}A_\mathfrak{p})^k \cong (A/\mathfrak{p}^k)_{\overline{\mathfrak{p}}}$?

Thanks


The linked MO question shows that the answer is yes when $\mathfrak p$ is maximal, the key point in that case being that the completion of $A$ at a maximal ideal is automatically local.

If $\mathfrak p$ is not maximal, then there will be a natural map $\hat{A}_{\hat{\mathfrak p}} \to \widehat{A_{\mathfrak p}}$. Indeed, there is a map $A \to A_{\mathfrak p}$, which induces a map of $\mathfrak p$-adic completions $\hat{A} \to \widehat{A_{\mathfrak p}},$ which in turn induces a map $\hat{A}_{\hat{\mathfrak p}} \to \widehat{A_{\mathfrak p}}.$ But this map won't be an isomorphism if $\mathfrak p$ is not maximal (at least if $A$ is Noetherian, so that the completions are reasonably behaved).

To see why, consider as an example the case when $A = \mathbb Z_p[x]$, and $\mathfrak p = (x)$. Then $A_{\mathfrak p} = \mathbb Q_p[x]_{(x)},$ and so $\widehat{A_{\mathfrak p}} = \mathbb Q_p[[x]].$ On the other hand, $\hat{A}_{\hat{\mathfrak p}} = \mathbb Z_p[[x]]_{(x)}$, which is a proper subring of $\mathbb Q_p[[x]]$. (E.g. an element of $\mathbb Z_p[[x]]_{(x)}$ defines a meromorphic function on the $p$-adic disk $1 > |x|$ with only finitely many zeroes and finitely many poles, none of the latter being at $x = 0$; in particular, it has a non-trivial radius of convergence around $0$. On the other hand, a typical function in $\mathbb Q_p[[x]]$ does not have any non-trivial radius of convergence around $0$.)

This illustrates the general phenomonon that when $\mathfrak p$ is not maximal, so that $\hat{A}_{\hat{\mathfrak p}}$ is a genuinely non-trivial localization, only certain $\mathfrak p$-adic limits exist in the localization $\hat{A}_{\hat{\mathfrak p}}$, while by construction $\widehat{A_{\mathfrak p}}$ is $\mathfrak p$-adically complete.