Пример #1
0
        public void Problem8_Can_Solve()
        {
            // Arrange
            var expected = 40824;
            var target = new Problem8();

            // Act
            var result = target.SolveFast();

            // Assert
            Assert.AreEqual(expected, result);
        }
Пример #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();
        }
Пример #3
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)}");
        }
 public void SetUp()
 {
     problem = new Problem8();
 }
Пример #5
0
        static void Main(string [] args)
        {
            Console.WriteLine(Problem8.Solution());

            Console.ReadLine();
        }