  In this paper, we determine the primitive solutions of the Diophantine
equation $(x-d)^2+x^2+(x+d)^2=y^n$ when $n\geq 2$ and $d=p^b$, $p$ a prime and
$p\leq 10^4$. The main ingredients are the characterization of primitive
divisors on Lehmer sequences and the development of an algorithmic method of
proving the non-existence of integer solutions of the equation $f(x)=a^b$,
where $f(x)\in\mathbb Z[x]$, $a$ a positive integer and $b$ an arbitrary
positive integer.
