I also used PARI/GP with the following program: c(n) = 2*cos(2*n*Pi/43); x(n) = c(1*n) + c(6*n) + c(7*n); print(bestappr(prod(n=1,7, z-x(n+3*(n>5))),10^9)) with the resulting output z^7+z^6-18*z^5-35*z^4+38*z^3+104*z^2+7*z-49 A simpler program with no defined functions is z1=exp(2*Pi*I/43); z2=r1^6; z3=r1^7; bestappr(prod(n=1,7, m=lift(Mod(3,43)^n);\ x - 2*real(z1^m + z2^m + z3^m)), 10^9)