The ring of integers $ \mathbb{Z} $ is a unique factorization domain. Similarly, the ring $ \mathbb{Z}[i] $ of Gaussian integers, which can be viewed as $ \mathbb{Z}^{2} $, is a UFD.
So my question is : which are the positive integers $ r $ such that $ \mathbb{Z}^{r} $ can be endowed with the structure of UFD ?
Motivation : trying to prove that if $ \mathbb{Z}^{m} $ can't be endowed with a structure of a UFD, then the maximal prime gap around $ x $ is a little oh of the average prime gap around $ x$ to the power $ m $ , hence $ \max_{n\le\pi(x)}p_{n+1}-p_{n}=o(\log^{m}x) $ . This would be a first step towards Cramer's conjecture.