// Counting the number of terms of general formula of // // the discriminant up to degree 12 // // Last modified: February 7, 2014 // var:=12; P:=PolynomialRing(Rationals(),var); V:=[1,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12]; // No need to change below // SDIV:=function(f,W,k) X,Y:=CoefficientsAndMonomials(f); U:=#X; I:=[i : i in [1..U] | Degree(Y[i],W) eq 0]; if #I eq 0 then return f/(k*W); else xx:=f-(&+[X[j]*Y[j] : j in I]); return xx/(k*W); end if; end function; S:=V[2]^2-4*V[3]; for N in [3..var] do T:=V[N]^2*S; S:=T; for K in [1..N-1] do U:=(-N)*Derivative(P!T,V[2]); for J in [2..N-1] do U:=U+(J-N-1)*V[J]*Derivative(P!T,V[J+1]); end for; T:=SDIV(P!U,P!V[N],K); S:=S+T*V[N+1]^K; end for; "(deg,#monomial)=(",N,",",#CoefficientsAndMonomials(P!S),")"; end for;