def POLYNOMIAL_OBTAINED_BY_RECURSION(p,n): R=Zmod(p) Z.<x>=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.<x>=PolynomialRing(R) All=[] All=POLYNOMIAL_OBTAINED_BY_RECURSION(p,n) All=MYSIEVE(n,All) return(All)