public string GetSolution()
        {
            var  i        = 1;
            long number   = 0;
            long divisors = 0;

            while (divisors < 500)
            {
                number = GetTriangleNumber(i);
                var primeFactors = Factors.GetPrimeFactors(number);
                divisors = GetDivisorCount(primeFactors);
                i++;
            }

            return(number.ToString());
        }
 public void GetPrimeFactors()
 {
     Assert.Equal(6, Factors.GetPrimeFactors(1000).Count());
 }
Beispiel #3
0
 public string GetSolution()
 {
     return(Factors.GetPrimeFactors(600851475143).Max().ToString());
 }
Beispiel #4
0
 public void GetPrimeFactors_TooSmallValueGiven_ThrowsExeption()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => Factors.GetPrimeFactors(0));
 }
Beispiel #5
0
        public void GetPrimeFactors_SupportedValueGiven_ReturnsCorrectSizeArray()
        {
            int[] results = Factors.GetPrimeFactors(10);

            Assert.That(results.Length, Is.EqualTo(3));
        }
Beispiel #6
0
        public void GetPrimeFactors_SupportedValueGiven_ReturnsArrayOfFactors()
        {
            int[] results = Factors.GetPrimeFactors(10);

            Assert.That(results, Is.EquivalentTo(new int[] { 1, 2, 5 }));
        }