예제 #1
0
        private bool IsLychrelNumber(int number)
        {
            string numberPresentation = number.ToString();

            for (int i = 0; i < 50; ++i)
            {
                numberPresentation = NumberAsString.Sum(new string[] { numberPresentation, new string(numberPresentation.Reverse().ToArray()) });
                if (IsPolindrom(numberPresentation))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        public string Run(int numbersCount)
        {
            string result = NumberAsString.Sum(numbers);

            return(result.Substring(0, numbersCount));
        }