cyclotomic takes an integer n as argument and returns the list of the coefficients of the cyclotomic polynomial of index n. This is the polynomial having the n-th primitive roots of unity as zeros (an n-th root of unity is primitive if the set of its powers is the set of all the n-th roots of unity).

For example, let n=4, the fourth roots of unity are:
{ 1,i,−1,−i} and the primitive roots are: {i,−i}.
Hence, the cyclotomic polynomial of index 4 is (x−i).(x+i)=x^{2}+1.
Verification:

cyclotomic(4)

Output :

[1,0,1]

Another example, input :

cyclotomic(5)

Output :

[1,1,1,1,1]

Hence, the cyclotomic polynomial of index 5 is x^{4}+x^{3}+x^{2}+x+1
which divides x^{5}−1 since (x−1)*(x^{4}+x^{3}+x^{2}+x+1)=x^{5}−1.

Input :

cyclotomic(10)

Output :

[1,-1,1,-1,1]

Hence, the cyclotomic polynomial of index 10 is x^{4}−x^{3}+x^{2}−x+1 and

(x^{5}−1)*(x+1)*(x^{4}−x^{3}+x^{2}−x+1)=x^{10}−1 |

Input :

cyclotomic(20)

Output :

[1,0,-1,0,1,0,-1,0,1]

Hence, the cyclotomic polynomial of index 20 is x^{8}−x^{6}+x^{4}−x^{2}+1 and

(x^{10}−1)*(x^{2}+1)*(x^{8}−x^{6}+x^{4}−x^{2}+1)=x^{20}−1 |