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};
 }
 void process(Generic generic[]) {
   boolean flag = true;
   for (int i = 0; i < generic.length; i++) {
     Generic s = generic[i];
     Variable va[] = s.variables();
     if (va.length == 1) {
       Variable t = va[0];
       Polynomial p = Polynomial.factory(t).valueOf(s);
       if (p.degree() > 1) {
         flag = false;
         Polynomial r[] = linearize(p, t);
         for (int j = 0; j < r.length; j++) {
           process(
               Basis.compute(Basis.augment(new Generic[] {r[j].genericValue()}, generic), unknown)
                   .elements());
         }
       }
     } else flag = false;
   }
   if (flag) result.add(generic);
 }
 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]);
 }