Ejemplo n.º 1
0
        /// <summary>
        /// Solves the problem
        /// </summary>
        /// <returns>The solution result</returns>
        public long Solve()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            long num = 9;
            GoldbachConjecture gC = new GoldbachConjecture(num, pReader.SmallerThan(num));

            while (gC.IsValid)
            {
                num += 2;
                if (!pReader.IsPrime(num))
                {
                    gC = new GoldbachConjecture(num, pReader.SmallerThan(num));
                }
            }
            sw.Stop();
            Console.WriteLine("Elapsed: {0}s, {1}ms", sw.Elapsed.Seconds, sw.Elapsed.Milliseconds);
            return(gC.OddNumber);
        }
 public void Initialize()
 {
     goldbachConjecture = new GoldbachConjecture();
 }
 public void Initialize()
 {
     goldbachConjecture = new GoldbachConjecture();
 }