static Polynomial[] remainder(Polynomial s, Polynomial p, Generic t[]) {
   Polynomial zero = s.valueOf(JsclInteger.valueOf(0));
   Generic a[] = Basis.augment(t, s.remainderUpToCoefficient(p).elements());
   Variable unk[] = Basis.augmentUnknown(new Variable[] {}, p.elements());
   {
     Variable u = unk[unk.length - 1];
     System.arraycopy(unk, 0, unk, 1, unk.length - 1);
     unk[0] = u;
   }
   Generic be[][] =
       Linearization.compute(
           Basis.compute(a, unk, Monomial.lexicographic, 0, Basis.DEGREE).elements(), unk);
   for (int i = 0; i < be.length; i++) {
     Polynomial r = substitute(p, be[i], unk);
     try {
       return new Polynomial[] {zero, r, s.divide(r)};
     } catch (NotDivisibleException e) {
     }
   }
   return new Polynomial[] {s, zero, zero};
 }
 static Polynomial substitute(Polynomial p, Generic a[], Variable unk[]) {
   Generic s[] = new Generic[] {p.genericValue()};
   return p.valueOf(
       Basis.compute(Basis.augment(a, s), Basis.augmentUnknown(unk, s)).elements()[0]);
 }