2022-09-26 21:43:30 +0200 received badge ● Notable Question (source) 2022-01-19 12:37:46 +0200 received badge ● Popular Question (source) 2019-07-16 15:58:45 +0200 asked a question Generate all the monic polynomials up to degree n with coefficients in Zp(p prime number) field and find all the irriducible polynomials My code. def POLYNOMIAL_OBTAINED_BY_RECURSION(p,n): R=Zmod(p) Z.=PolynomialRing(R) All=[] if n==1: h=[] for i in range(0,p): pol=x+i h.append(pol) return(pol) All.append(Set(h)) else : h=[] for i in range(0,p): Pol=POLYNOMIAL_OBTAINED_BY_RECURSION(p,n-1)+i*(x^(n-1))+x^n h.append(Pol) return(Pol) All.append(Set(h)) return(All) def MYSIEVE(n,All) for d in range(1,floor(n/2)+1): for j in range(d+1,n+1): for polinomio1 in All[j]: for polinomio2 in All[d]: if polinomio1%polinomio2==0: k={polinomio1} All[j].difference(k) return(All) def project(p,n): if not(is_prime(p)): print('p is not prime',p) R=Zmod(p) Z.=PolynomialRing(R) All=[] All=POLYNOMIAL_OBTAINED_BY_RECURSION(p,n) All=MYSIEVE(n,All) return(All)