How to resolve the algorithm Cyclotomic polynomial step by step in the PARI/GP programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Cyclotomic polynomial step by step in the PARI/GP programming language

Table of Contents

Problem Statement

The nth Cyclotomic polynomial, for any positive integer n, is the unique irreducible polynomial of largest degree with integer coefficients that is a divisor of x^n − 1, and is not a divisor of x^k − 1 for any k < n.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Cyclotomic polynomial step by step in the PARI/GP programming language

Source code in the pari/gp programming language

for(n=1,30,print(n," : ",polcyclo(n)))

contains_coeff(n, d) = p=polcyclo(n);for(k=0,poldegree(p),if(abs(polcoef(p,k))==d,return(1)));return(0)

for(d=1,10,i=1; while(contains_coeff(i,d)==0,i=i+1);print(d," : ",i))

  

You may also check:How to resolve the algorithm Knapsack problem/Unbounded step by step in the C programming language
You may also check:How to resolve the algorithm Balanced ternary step by step in the C programming language
You may also check:How to resolve the algorithm Classes step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Sorting algorithms/Shell sort step by step in the REXX programming language
You may also check:How to resolve the algorithm Write language name in 3D ASCII step by step in the Raku programming language