Beispiel #1
0
        public void GetListOfProperDivisors_Of220_ReturnsCorrectList()
        {
            // Arrange
            var number = 220;
            var properDivisorsOfNumber = new List <int> {
                1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110
            };

            // Act
            var result = DivisorHelper.GetListOfProperDivisors(number);

            // Assert
            result.Should().BeEquivalentTo(properDivisorsOfNumber);
        }
Beispiel #2
0
 private bool IsAbundantNumber(int n)
 {
     return(DivisorHelper.GetListOfProperDivisors(n).Sum() > n);
 }
Beispiel #3
0
 private int GetSumOfProperDivisors(int n)
 {
     return(DivisorHelper.GetListOfProperDivisors(n).Sum());
 }