def dup_primitive_prs(f, g, K):
 prs = [f, g]
 (_, h) = dup_primitive(dup_prem(f, g, K), K)
 while h:
  prs.append(h)
  (f, g) = (g, h)
  (_, h) = dup_primitive(dup_prem(f, g, K), K)
 return prs

def dup_primitive_prs ( f , g , K ) : prs = [ f , g ] ( _ , h ) = dup_primitive ( dup_prem ( f , g , K ) , K ) while h : prs . append ( h ) ( f , g ) = ( g , h ) ( _ , h ) = dup_primitive ( dup_prem ( f , g , K ) , K ) return prs
primitive polynomial remainder sequence in k[x] .