Ejemplo n.º 1
0
		static void Main(string[] args)
		{
			Euler tt = new Euler(1);
			tt.initialise();
			tt.runiters();
			tt.validate();
		}
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Euler tt = new Euler(1);

            tt.initialise();
            tt.runiters();
            tt.validate();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Sum of the multiples of 3 and 5 under 1000 = {0}",
                              Euler.SumMultiplesOfThreeAndFive(1000));

            Console.WriteLine("Sum of even Fibonacci numbers up to 4 million = {0}",
                              Euler.SumFibonacciSequenceUpToMaximum(4000000, true));

            Console.WriteLine("Largest prime factor of 600851475143 = {0}",
                              Euler.GetLargestPrimeFactor(600851475143));

            Console.WriteLine("Largest palindrome made from the product of two 3-digit numbers = {0}",
                              Euler.FindLargestPalindrome(3));

            Console.Read();
        }
Ejemplo n.º 4
0
 public void TestFirst10Fibonacci()
 {
     CollectionAssert.AreEqual(Euler.GetFibonacciSequence(10), new [] { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 });
 }
Ejemplo n.º 5
0
 public void TestFirst2Fibonacci()
 {
     CollectionAssert.AreEqual(Euler.GetFibonacciSequence(2), new[] { 1, 2 });
 }
Ejemplo n.º 6
0
 public void Test691IsPrimeNumber()
 {
     Assert.IsTrue(Euler.IsPrimeNumber(691));
 }
Ejemplo n.º 7
0
 public void TestFourIsNotPrimeNumber()
 {
     Assert.IsFalse(Euler.IsPrimeNumber(4));
 }
Ejemplo n.º 8
0
 public void TestSumFibonacciEvenSequenceThatDoesNotExceed100()
 {
     Assert.AreEqual(Euler.SumFibonacciSequenceUpToMaximum(100, true), 44);
 }
Ejemplo n.º 9
0
 public void TestFibonacciSequenceThatDoesNotExceed100()
 {
     CollectionAssert.AreEqual(Euler.GetFibonacciSequenceUpToMaximum(100), new[] { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 });
 }
Ejemplo n.º 10
0
 public void TestGetLargestPrimeFactorOf13195()
 {
     Assert.AreEqual(Euler.GetLargestPrimeFactor(13195), 29);
 }
Ejemplo n.º 11
0
 public void TestGetPrimeFactorsOf13195()
 {
     CollectionAssert.AreEqual(Euler.GetPrimeFactors(13195), new[] { 5, 7, 13, 29 });
 }
Ejemplo n.º 12
0
 public void TestSumMultiplesOfThreeAndFiveBelowZero()
 {
     Assert.AreEqual(Euler.SumMultiplesOfThreeAndFive(0), 0);
 }
Ejemplo n.º 13
0
 public void TestGetPrimeNumbersUnder22()
 {
     CollectionAssert.AreEqual(Euler.GetPrimeNumbers(22), new [] { 2, 3, 5, 7, 11, 13, 17, 19 });
 }
Ejemplo n.º 14
0
 public void TestGetPrimeNumbersUnder2()
 {
     Assert.AreEqual(Euler.GetPrimeNumbers(2).Length, 0);
 }
Ejemplo n.º 15
0
 public void TestSumFirst2Fibonacci()
 {
     Assert.AreEqual(Euler.SumFibonacciSequence(2), 3);
 }
Ejemplo n.º 16
0
 public void TestSumFirst10Fibonacci()
 {
     Assert.AreEqual(Euler.SumFibonacciSequence(10), 231);
 }
Ejemplo n.º 17
0
 public void TestIs99Palindrome()
 {
     Assert.IsTrue(Euler.IsPalindrome(99));
 }
Ejemplo n.º 18
0
 public void TestFibonacciEvenSequenceThatDoesNotExceed100()
 {
     CollectionAssert.AreEqual(Euler.GetFibonacciSequenceUpToMaximum(100, true), new[] { 2, 8, 34 });
 }
Ejemplo n.º 19
0
 public void TestIs10001Palindrome()
 {
     Assert.IsTrue(Euler.IsPalindrome(10001));
 }
Ejemplo n.º 20
0
 public void TestTwoIsPrimeNumber()
 {
     Assert.IsTrue(Euler.IsPrimeNumber(2));
 }
Ejemplo n.º 21
0
 public void TestIs1231Palindrome()
 {
     Assert.IsFalse(Euler.IsPalindrome(1231));
 }
Ejemplo n.º 22
0
 public void TestTwentyThreeIsPrimeNumber()
 {
     Assert.IsTrue(Euler.IsPrimeNumber(23));
 }
Ejemplo n.º 23
0
 public void TestFindLargestPalindromeThatIsMultipleOfTwoTwoDigitNumbers()
 {
     Assert.AreEqual(Euler.FindLargestPalindrome(2), 9009);
 }
Ejemplo n.º 24
0
 public void Test693IsNotPrimeNumber()
 {
     Assert.IsFalse(Euler.IsPrimeNumber(693));
 }
Ejemplo n.º 25
0
 public void TestSumMultiplesOfThreeAndFiveBelowTen()
 {
     Assert.AreEqual(Euler.SumMultiplesOfThreeAndFive(10), 23);
 }