예제 #1
0
        public override object Run(RunModes runMode, object input, bool Logging)
        {
            int minIndex = (int)input + 1;

            while (true)
            {
                long tri = Triangle.Generate(minIndex);
                if (Pentagonal.IsPentagonal(tri) && Hexagonal.IsHexagonal(tri))
                {
                    return(tri);
                }
                minIndex++;
            }
        }
예제 #2
0
        public override object Run(RunModes runMode, object input, bool Logging)
        {
            int maxIndex = (int)input;

            for (int i = 1; i < maxIndex; i++)
            {
                for (int j = 1; j < i - 1; j++)
                {
                    var pentI = Pentagonal.Generate(i);
                    var pentJ = Pentagonal.Generate(j);
                    if (i > j && Pentagonal.IsPentagonal(pentI - pentJ))
                    {
                        if (Pentagonal.IsPentagonal(pentI + pentJ))
                        {
                            return(pentI - pentJ);
                        }
                    }
                }
            }
            return(0);
        }