If \( \alpha \) is a root of the equation \( x^2 + x + 1 = 0 \) and \( \displaystyle \sum_{k=1}^{n}\left(\alpha^k+\frac{1}{\alpha^k}\right)^2 = 20 \), then \( n \) is equal to ________________.