public static PolinomDiv Divide(this Polinom polinom, Polinom divider) { var power = polinom.Power - divider.Power; var result = new Polinom(); var reminder = polinom; (power + 1).ForEachNum(i => { if (reminder.Power + i == polinom.Power) { var c = reminder.Root / divider.Root; var subPolinom = (c * divider).PowerShiftUp(power - i); reminder = reminder - subPolinom; result.PowerUp(c); } else { result.PowerUp(0); } }); return(new PolinomDiv() { Result = result, Remainder = reminder }); }