<s>[INST] A smarter (not bashy) way to solve this roots of unity problem? (Mandelbrot) Let $\xi = \cos \frac{2\pi}{5} + i \sin \frac{2pi}{5}$ be a complex fifth root of unity. Set $a = 20\xi^2 + 13 \xi, b = 20\xi^4 + 13\xi^2, c = 20\xi^3 + 13\xi^4, \text{and } d = 20\xi + 13\xi^3$. Find $a^3 + b^3 + c^3 + d^3$
Immediately what comes to mind is finding $(a + b + c + d)^3$ and subtracting whatever we don't need to get $a^3 + b^3 + c^3 + d^3$. However,
\begin{equation*}
(a+b+c+d)^3 = a^3+3a^2b+3a^2c+3a^2d+3ab^2+6abc+6abd+3ac^2+6acd+3ad^2+b^3+3b^2c+3b^2d+3bc^2+6bcd+3bd^2 + c^3 + 3c^2d + 3cd^2 + d^3
\end{equation*}
There is simply no good way to calculate $6abc + 6abd + 6acd + 6bcd $ without expanding everything.
 [/INST] Let $\omega_1, \ldots, \omega_p$ be the $p$th roots of unity (including $1$), where $p$ is prime. Note that:
$$\omega_1^k + \ldots + \omega_p^k = \begin{cases} p & \text{if } p \mid k \\ 0 & \text{otherwise.} \end{cases}$$
Why? The group of $p$th roots of unity are isomorphic to $\Bbb{Z} / p\Bbb{Z}$, and the map $x \mapsto x^k$ is equivalent to the map $x \mapsto kx$ on $\Bbb{Z} / 5 \Bbb{Z}$. It's well know that this homomorphism is trivial when $p \mid k$, and injective (and thus surjective) otherwise. So, when $p \not\mid k$, we are summing the $p$th roots of unity, which is $0$.
So, if we have a polynomial $q$, we can evaluate $q(\omega_1) + \ldots + q(\omega_p)$ relatively easily. We get:
$$q(\omega_1) + \ldots + q(\omega_p) = p(q_0 + q_p + q_{2p} + \ldots),$$
where $q_i$ is the coefficient of $x^i$, and the sum on the right hand side is necessarily finite, due to the finite degree of $q$.
In your case, where $p = 5$, we have $a^3, b^3, c^3, d^3, (20 + 13)^3$ are (not necessarily respectively) $q(\omega_1), \ldots, q(\omega_5)$, where
$$q(x) = (20x^2 + 13x)^3.$$
We only care about the coefficients of $x^5$ and $x^0$, the latter of which is clearly $0$, and the former is $3 \cdot 20^2 \cdot 13$. So,
$$a^3 + b^3 + c^3 + d^3 + 33^3 = 15 \cdot 20^2 \cdot 13,$$
hence the answer is $15 \cdot 20^2 \cdot 13 - 33^3$
</s>