Exemple #1
0
        public static int HighlyDivisibleTriangularNumber(int n)
        {
            List <long> triangles = SpecialSequences.triangularnumbers(n * n);

            foreach (int triangle in triangles)
            {
                if (MiscFunctions.Divisors(triangle).Count() > n)
                {
                    return(triangle);
                }
            }
            return(0);
        }
Exemple #2
0
        public static int CodedTriangleNumbers(string n)
        {
            int    count = 0;
            string str   = FileFunctions.readfileintostring("Problem42");

            str = str.Replace("/", "");
            str = str.Replace("\"", "");
            string[]    arr       = str.Split(',');
            List <long> triangles = SpecialSequences.triangularnumbers(1000);

            foreach (string word in arr)
            {
                if (triangles.Contains(MiscFunctions.UppercaseWordValue(word)))
                {
                    count++;
                }
            }
            return(count);
        }