コード例 #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");
        }
コード例 #2
0
        public void GetFactorsAmount_Prime_2(int n)
        {
            var solver = new CountFactors();
            var amount = solver.GetFactorsAmount(n);

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

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

            amount.Should().Be(1);
        }
コード例 #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");
        }