(f, n, g, b, p, K)
return res
utility function for ``gf_edf_zassenhaus``
    Compute ``f**((p**n - 1) // 2)`` in ``GF(p)[x]/(g)``
    ``f**((p**n - 1) // 2) = (f*f**p*...*f**(p**n - 1))**((p - 1) // 2)``
utility function for ``gf_edf_zassenhaus``
    Compute ``f**((p**n - 1) // 2)`` in ``GF(p)[x]/(g)``
    ``f**((p**n - 1) // 2) = (f*f**p*...*f**(p**n - 1))**((p - 1) // 2)``
utility function for gf_edf_zassenhaus Compute f ** (( p ** n - 1 ) // 2 ) in GF ( p ) [ x ] / ( g ) f ** (( p ** n - 1 ) // 2 ) = ( f * f ** p * ... * f ** ( p ** n - 1 )) ** (( p - 1 ) // 2 )
def _gf_pow_pnm1d2(f, n, g, b, p, K):
    """
    utility function for ``gf_edf_zassenhaus``
    Compute ``f**((p**n - 1) // 2)`` in ``GF(p)[x]/(g)``
    ``f**((p**n - 1) // 2) = (f*f**p*...*f**(p**n - 1))**((p - 1) // 2)``
    """
    f = gf_rem(f, g, p, K)
    h = f
    r = f
    for i in range(1, n):
        h = gf_frobenius_map(h, g, b, p, K)
        r = gf_mul(r, h, p, K)
        r = gf_rem(r, g, p, K)

    res = gf_pow_mod(r, (p - 1)//2, g, p, K)
    return res
def _gf_pow_pnm1d2 ( f , n , g , b , p , K ) : f = gf_rem ( f , g , p , K ) h = f r = f for i in range ( 1 , n ) : h = gf_frobenius_map ( h , g , b , p , K ) r = gf_mul ( r , h , p , K ) r = gf_rem ( r , g , p , K ) res = gf_pow_mod ( r , ( p - 1 ) // 2 , g , p , K ) return res