Let $p \equiv 1 \bmod 4$ be a prime number. Define the polynomial $$ f(x) = \sum_{a=1}^{p-1} \Big(\frac{a}{p}\Big) x^a. $$ Then $f(x) = x(1-x)^2(1+x)g(x)$ for some polynomial $g \in {\mathbb Z}[x]$ (this follows from elementary properties of quadratic residues).
For $p = 5$, we have $g = 1$; for $p = 13$, we find $$ g(x) = x^8 + 2x^6 + 2x^5 + 3x^4 + 2x^3 + 2x^2 + 1. $$ pari tells me that the Galois group is "2^4 S(4)" and has order $384 = 16 \cdot 24$.
My questions:
- Have these polynomials been studied anywhere? Since I did not just make them up, I am tempted to believe that they are natural enough to have shown up somewhere else.
- Is $g$ always irreducible? pari says it is for all p < 400.