Let $\{ \xi^{i} \}_{i=1}^{n}$ be $n$-th roots of unity for some positive integer $n$. It is well known that if $n$ is a prime integer, there will be $n-1$ primitive $n$-th roots of unity which are linearly independent over $\mathbb{Q}$. In other words, the following relation is valid only when all the coefficients $a_i$s are zeros. $$\sum_{i=1}^{n-1}a_i\xi^i=0. $$ If $n$ is not a prime number, such linear independence can still be shown for the primitive $n$-th roots of unity (Edit: if and only if $n$ is square-free). Now my question is related to the linear independence of the sequential roots of unity.
To be precise, what is the maximum value of $k<n$, for which the roots $\xi, \xi^2, ...\xi^k$ are linearly independent. Where $n$ is a positive integer and not necessarily a prime number. And also is there a way to check the linear independence of roots of unity numerically using Python or any other programming language?. I am a physics graduate and encountered this problem while solving a physics-related question. Can someone please provide an intuitive answer with an explanation? Thanks in advance.