connection between two distinct prime numbers $p,q$ such that $p^n=q^2+q+1$ Let $p,q$ be two distinct prime number such that $p^n=q^2+q+1$, where $n \in \Bbb{N}$. I want to proof that, this forces $n=1$.
 A: Erdös and Selfridge proved that a product of consecutive integers can never be a perfect power. That is, the equation 
$$
x(x + 1)\cdots  (x + (m - 1)) = y^n 
$$
has no solutions in positive integers $x,y,m,n$ with $m,n > 1$. Also for
$$
x(x + 1)\cdots  (x + (m - 1))+1 = y^n 
$$
all solutions are explicitly known, see here, and the reference to the paper of N. Abe. For $m=2$ we obtain the above equation $x^2+x+1=y^n$. There is no integer solution for $n>1$.
A related problem can be found in Ribenboim's book, where he gives all solutions of the Diophantine equation
$$
y^2=1+x+x^2+\cdots +x^k.
$$
A: I borrowed two books on contest problems; this one is An Introduction to Diophantine Equations, by Titu Andreescu, Dorin Andrica, and Ion Cucurezeanu. Most of what is needed for your problem, probably all, is in section 4.2, The Ring of Integers of $\mathbb Q[\sqrt d].$ This is mentioned above by Jack, suggesting working in the Eisenstein integers $\mathbb Z[\sqrt {-3}],$ which is a UFD.
This is a pretty good start...
We have $x^2 + x + 1 = p^n;$ I am not sure yet whether the restriction that $x$ be prime matters. We have, page 168, the unit
$$  \omega = \frac{-1 + \sqrt {-3}}{2}, $$
which is a cube root of $1.$ The main detail is that $\sqrt {-3}$ is irreducible in $\mathbb Z[\sqrt {-3}].$ On page 173 we have some examples of finding gcd of two quantities. Also on page 177, problem 2 is similar to yours, solution takes pages 315-319.  Note that
$$   \omega^2 = -1 - \omega,$$
$$     \omega -  \omega^2 =  \sqrt {-3}. $$
Alright, we have factorization
$$  (x - \omega)(x - \omega^2) = p^n.  $$
We need to know
$$ \gcd(x - \omega, x - \omega^2). $$ If some $\delta$ in the ring divides both, then it divides $     \omega -  \omega^2 =  \sqrt {-3}. $ However, this is irreducible, so
$$ \gcd(x - \omega, x - \omega^2)= 1. $$
It follows that each factor is such a power, that is
$$  x - \omega = (a + b \omega)^n, $$
for ordinary $a,b \in \mathbb Z.$ NOTE: remind me to put in alternatives
$$   x - \omega =  \omega(a + b \omega)^n, \; \; \;    x - \omega =  \omega^2(a + b \omega)^n.  $$
What I have so far is the implication
$ b = \pm 1;  $ let me do exponent $n=5.$
$$  x - \omega = (a + b \omega)^5, $$
$$  x - \omega = a^5 + 5 a^4 b \omega + 10 a^3 b^2 \omega^2 + 10 a^2 b^3 + 5 a b^4 \omega + b^5 \omega^2. $$
Remember $\omega^2 = -1 - \omega,$ so that
$$  x - \omega = (a^5 - 10 a^3 b^2 + 10 a^2 b^3 - b^5)  + (5 a^4 b  - 10 a^3 b^2   + 5 a b^4  - b^5 ) \omega. $$ The coefficient of $\omega$ needs to be $-1,$ that is
$$ (5 a^4 b  - 10 a^3 b^2   + 5 a b^4  - b^5 ) = -1 $$
and
$$ b(5 a^4   - 10 a^3 b   + 5 a b^3  - b^4 ) = -1. $$
Well, $b$ is an ordinary integer, and $b$ divides $-1.$ that is,
$$  b = \pm 1. $$
 Next, we need either
$$ 5 a^4   - 10 a^3    + 5 a   - 1  = -1, $$ or
$$ 5 a^4   + 10 a^3   - 5 a   - 1 = -1. $$ Either way,
divide out by $5a,$
$$ a^3 + 2 a^2 - 1 = 0  $$ OR
$$ a^3 - 2 a^2 + 1 = 0.  $$
The rational root theorem tells us that $a = \pm 1$ as well.
