Find the numerical value of this expression If $x$ is a complex number such that $x^2+x+1=0$, then the numerical value of $(x+\frac{1}{x})^2+(x^2+\frac{1}{x^2})^2+(x^3+\frac{1}{x^3})^2+\ldots+(x^{27}+\frac{1}{x^{27}})^{2}$ is equal to?
A) 52 .   B) 56 .   C) 54.   D)58 .  E)None of these
Where is this question from?  I'm pretty sure it comes from one high school math contest, does anyone one know which math contest and of course i can't solve, I have an answer key but I don't know the solution.

Multiply both sides by $x-1\ne 0$:
$$x^2+x+1=0 \Rightarrow (x-1)(x^2+x+1)=0 \Rightarrow x^3-1=0 \Rightarrow x^3=1\Rightarrow \\
x^{54}=1;x^{-54}=1 \quad (1)$$
Expand:
$$(x+\frac{1}{x})^2+(x^2+\frac{1}{x^2})^2+(x^3+\frac{1}{x^3})^2+\ldots+(x^{27}+\frac{1}{x^{27}})^{2}=\\
[x^2+x^4+\cdots+x^{54}]+[x^{-2}+x^{-4}+\cdots+x^{-54}]+2\cdot 27=\\
\frac{x^2(x^{54}-1)}{x^2-1}+\frac{x^{-2}(x^{-54}-1)}{x^2-1}+54\stackrel{(1)}=54.\\
$$
