def gf_frobenius_monomial_base(g, p, K):
 n = gf_degree(g)
 if (n == 0):
  return []
 b = ([0] * n)
 b[0] = [1]
 if (p < n):
  for i in range(1, n):
   mon = gf_lshift(b[(i - 1)], p, K)
   b[i] = gf_rem(mon, g, p, K)
 elif (n > 1):
  b[1] = gf_pow_mod([K.one, K.zero], p, g, p, K)
  for i in range(2, n):
   b[i] = gf_mul(b[(i - 1)], b[1], p, K)
   b[i] = gf_rem(b[i], g, p, K)
 return b

def gf_frobenius_monomial_base ( g , p , K ) : n = gf_degree ( g ) if ( n == 0 ) : return [ ] b = ( [ 0 ] * n ) b [ 0 ] = [ 1 ] if ( p < n ) : for i in range ( 1 , n ) : mon = gf_lshift ( b [ ( i - 1 ) ] , p , K ) b [ i ] = gf_rem ( mon , g , p , K ) elif ( n > 1 ) : b [ 1 ] = gf_pow_mod ( [ K . one , K . zero ] , p , g , p , K ) for i in range ( 2 , n ) : b [ i ] = gf_mul ( b [ ( i - 1 ) ] , b [ 1 ] , p , K ) b [ i ] = gf_rem ( b [ i ] , g , p , K ) return b
return the list of x** mod g in z_p for i = 0 .