title: Does sympy.rem() run in polynomial time?
body: <p>I am currently using the code</p>
  
  <pre><code>sym.rem((x + a)**n -(x**n + a), x**r - 1)
  </code></pre>
  
  <p>to check whether the polynomial (x+a)^n is congruent to (x^n + a) modulo (x^r - 1). However, I have noticed that as the size of n increases, the time taken for this line to run increases very dramatically.</p>
  
  <p>Does sympy.rem() run in polynomial time?</p>