public FinderPolynom() { Console.Write("Input field:"); int field = int.Parse(Console.ReadLine()); Console.Write("Degree:"); N = int.Parse(Console.ReadLine()); if (Directory.Exists(@"Polynomials")) { Directory.Delete(@"Polynomials", true); } ///Записываем многочлены первой степени /// String firstDegree = ""; for (int i = 0; i < field; ++i) { firstDegree += i + "1" + Environment.NewLine; } Directory.CreateDirectory(@"Polynomials"); File.WriteAllText(@"Polynomials/1.txt", firstDegree); Polynomials = new List <HashSet <int[]> >(); this.field = field; pa = new PolynomArithmetics(field); }
private void CheckIrreducibility(int[] polynomial) { for (var i = 1; i <= (polynomial.Length - 1) / 2; i++) { foreach (var irreducible in Polynomials[i]) { int[] remainder = PolynomArithmetics.Deconv(polynomial, irreducible); if (remainder.Length == 0) { return; } } } lock (Polynomials) Polynomials[polynomial.Length - 1].Add(polynomial); }