Esempio n. 1
0
        public void Test1()
        {
            /*
             * Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are:
             * 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
             * It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal.
             */

            var sut = new E044Pentagonnumbers();

            //Assert.True(sut.HasSubstringdivisibility(1406357289));
            //Assert.True(sut.HasSubstringdivisibility(4160357289 ));
            //Assert.False(sut.HasSubstringdivisibility(1406395728));
        }
Esempio n. 2
0
        public void Solution()
        {
            /*
             * Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal
             * and D = |Pk − Pj| is minimised; what is the value of D?
             */

            var sut = new E044Pentagonnumbers();

            Assert.Equal(5482660, sut.GetMinimumD());

            /*
             * Congratulations, the answer you gave to problem 44 is correct.
             *
             *  You are the 50969th person to have solved this problem.
             */
        }