コード例 #1
0
        public static long GetSolutionOfProblem36()
        {
            var max = 1000000;

            return(Enumerable.Range(0, max)
                   .Where(number => PalindromeHelper.IsPalindrome(number) && PalindromeHelper.IsPalindromeInBase2(number))
                   .ToList().Sum());
        }
コード例 #2
0
        public static bool IsALynchrelNumberInMaxNumberOfSteps(BigInteger number, int maximumNumberOfSteps)
        {
            foreach (int _ in Enumerable.Range(1, maximumNumberOfSteps))
            {
                number += Reverse(number);
                if (PalindromeHelper.IsPalindrome(number))
                {
                    return(false);
                }
            }

            return(true);
        }