Exemple #1
0
        public static uint Solution()
        {
            List <uint> evens = Problem2.GetFibonacciNumbersBelowX(4000000).Where(x => x % 2 == 0).ToList();
            uint        sum   = 0;

            for (int i = 0; i < evens.Count; i++)
            {
                sum += evens [i];
            }
            return(sum);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            int answer;

            Console.WriteLine("Project Euler - Problem 1");
            Problem1 problem1 = new Problem1();

            problem1.Solve();
            Console.ReadKey();


            Console.WriteLine("Project Euler - Problem 2");
            Problem2.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 3");
            Problem3.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 4");
            Problem4.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 5");
            Problem5.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 6");
            Problem6.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 7");
            Problem7.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 8");
            Problem8.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 9");
            Problem9.Solve();
            Console.ReadKey();

            Console.WriteLine("Project Euler - Problem 10");
            Problem10.Solve();
            Console.ReadKey();
        }
Exemple #3
0
 static void Main(string[] args)
 {
     //Console.WriteLine(Problem1.CalculateSumMultiples3And5());
     Console.WriteLine(Problem2.CalculateSumEvenNumberFibonacciLessThan4Million());
 }
Exemple #4
0
        public static void Main(string[] args)
        {
            Console.WriteLine($"Problem1: Find the sum of all the multiples of 3 or 5 below 1000. Answer : {Problem1.Solve(3, 5, Problem1BelowValue-1)}");

            Console.WriteLine($"Problem2: By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. Answer : {Problem2.Solve(Problem2FibLimt)}");

            Console.WriteLine($"Problem3: What is the largest prime factor of the number 600851475143? Answer : {Problem3.Solve(Problem3LargestPrime)}");

            Console.WriteLine($"Problem4 :  Find the largest palindrome made from the product of two 3-digit numbers. Answer : {Problem4.Solve()}");

            Console.WriteLine($"Problem5 :  What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?. Answer : {Problem5.Solve(20)}");

            Console.WriteLine($"Problem6 :  Find the difference between the sum of the squares of the first 100 natural numbers and the square of the sum. Answer : {Problem6.Solve(100)}");

            Console.WriteLine($"Problem7 :  What is the 10 001st prime number? Answer : {Problem7.Solve1(10001)}");

            Console.WriteLine($"Problem8 :  Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? Answer : {Problem8.Solve(13)}");
        }
Exemple #5
0
 public void SumTest()
 {
     Problem2 target = new Problem2();
     target.Sum();
 }
 public void SetUp()
 {
     problem = new Problem2();
 }