'Construct a polynomial with n-th powers of roots of ``f``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> f = Poly(x**4 - x**2 + 1)
>>> f.nth_power_roots_poly(2)
Poly(x**4 - 2*x**3 + 3*x**2 - 2*x + 1, x, domain=\'ZZ\')
>>> f.nth_power_roots_poly(3)
Poly(x**4 + 2*x**2 + 1, x, domain=\'ZZ\')
>>> f.nth_power_roots_poly(4)
Poly(x**4 + 2*x**3 + 3*x**2 + 2*x + 1, x, domain=\'ZZ\')
>>> f.nth_power_roots_poly(12)
Poly(x**4 - 4*x**3 + 6*x**2 - 4*x + 1, x, domain=\'ZZ\')'

def nth_power_roots_poly(f, n):

    if f.is_multivariate:
        raise MultivariatePolynomialError('must    be    a    univariate    polynomial')
    N = sympify(n)
    if (N.is_Integer and (N >= 1)):
        n = int(N)
    else:
        raise ValueError(("'n'    must    an    integer    and    n    >=    1,    got    %s" % n))
    x = f.gen
    t = Dummy('t')
    r = f.resultant(f.__class__.from_expr(((x ** n) - t), x, t))
    return r.replace(t, x)
