Example #1
0
        public long GetNext(long next)
        {
            while (true)
            {
                var nextTriangleNumber = TriangleNumber.GetNumber(next);

                if (Pentagonnumber.GetN(nextTriangleNumber) > 0 && HexagonalNumber.GetN(nextTriangleNumber) > 0)
                {
                    return(nextTriangleNumber);
                }

                next++;
            }
        }
Example #2
0
 public void TestTriangleGetN(long n, int tn)
 {
     Assert.Equal(tn, Pentagonnumber.GetN(n));
 }