Let $p$ a prime number; I want to prove that for every $d \leq p-1$ there exists some cyclic code $C$ with words' length $p-1$ over the field of $p$ elements, such that $d(C)=d$.
I can obviously construct such a linear code, but couldn't find a method to generate cyclic codes with that property. I tried to use the fact that $x^{p-1}-1=(x-1)(x-2)...(x-p+1)$, but I couldn't really use that.
I think it has something to do with the fact that the field of $p$ elements has some primitive element, but I don't really know how to use it.