def dmp_primitive(f, u, K):
 (cont, v) = (dmp_content(f, u, K), (u - 1))
 if (dmp_zero_p(f, u) or dmp_one_p(cont, v, K)):
  return (cont, f)
 else:
  return (cont, [dmp_quo(c, cont, v, K) for c in f])

def dmp_primitive ( f , u , K ) : ( cont , v ) = ( dmp_content ( f , u , K ) , ( u - 1 ) ) if ( dmp_zero_p ( f , u ) or dmp_one_p ( cont , v , K ) ) : return ( cont , f ) else : return ( cont , [ dmp_quo ( c , cont , v , K ) for c in f ] )
returns multivariate content and a primitive polynomial .