public static List <BigInteger> LoadPrimes()
        {
            if (!Directory.Exists(basePath))
            {
                Directory.CreateDirectory(basePath);
            }
            List <BigInteger> result = new List <BigInteger>();

            try
            {
                using (BinaryReader reader = new BinaryReader(File.Open(basePath + "PrimeDatabase.savedata", FileMode.Open)))
                {
                    int length = reader.ReadInt32();
                    for (int i = 0; i < length; i++)
                    {
                        result.Add(MathExtras.ReadBigInteger(reader));
                    }
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Error loading Primes");
                return(new List <BigInteger>());
            }
            return(result);
        }
        private static List <BigInteger> ReadFactors(BinaryReader reader)
        {
            List <BigInteger> factors = new List <BigInteger>();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                factors.Add(MathExtras.ReadBigInteger(reader));
            }
            return(factors);
        }