Beispiel #1
0
        public void GetFactorsAmount_MaxInt_IsPrime()           //!!! 2^n-1 sometimes is prime; 2^32-1 indeed !
        {
            var solver = new CountFactors();
            var amount = solver.GetFactorsAmount(int.MaxValue);

            _outputHelper.WriteLine($"max int has {amount} divisors");
        }
Beispiel #2
0
        public void GetFactorsAmount_Prime_2(int n)
        {
            var solver = new CountFactors();
            var amount = solver.GetFactorsAmount(n);

            amount.Should().Be(2);
        }
Beispiel #3
0
        public void GetFactorsAmount_Composite_Many(int n, int expected)
        {
            var solver = new CountFactors();
            var amount = solver.GetFactorsAmount(n);

            amount.Should().Be(expected);
        }
Beispiel #4
0
        public void GetFactorsAmount_Small_1(int n)
        {
            var solver = new CountFactors();
            var amount = solver.GetFactorsAmount(n);

            amount.Should().Be(1);
        }
Beispiel #5
0
        public void GetFactorsAmount_BigInt_Many()
        {
            var bigNumber = 2_147_395_600;
            var solver    = new CountFactors();
            var amount    = solver.GetFactorsAmount(bigNumber);

            _outputHelper.WriteLine($"{bigNumber} has {amount} divisors");
        }