public static void Test40()
    {
        PalindromCalculator cal = new PalindromCalculator();

        cal.Limit = 1000;

        bool verbose = false;

        int foundPalindroms = 0;
        int maxSteps        = -1;

        for (int i = 1; i <= 10000; i++)
        {
            String s = i.ToString();
            cal.Start = new Number(s);
            bool b = cal.CalcPalindrom();
            if (b)
            {
                foundPalindroms++;

                if (cal.Steps > maxSteps)
                {
                    maxSteps = cal.Steps;
                }

                if (verbose)
                {
                    Console.WriteLine("Found Palindrom: Start = {0} -- Palindrom = {1} -- Steps: {2}",
                                      cal.Start, cal.Palindrom, cal.Steps);
                }
                else
                {
                    if (i % 1000 == 0)
                    {
                        Console.Write(".");
                    }
                }
            }
            else
            {
                if (verbose)
                {
                    Console.WriteLine("No Palindrom: Start = {0}", cal.Start);
                }
            }
        }

        Console.WriteLine();
        Console.WriteLine("Total Palindroms: {0}      Max Steps: {1}",
                          foundPalindroms, maxSteps);
    }
    public static void MostDelayedPalindromicNumberRecord()
    {
        PalindromCalculator cal = new PalindromCalculator();

        cal.Limit = 300;
        cal.Start = new Number("1186060307891929990");
        if (cal.CalcPalindrom())
        {
            Console.WriteLine("Most Delayed Palindromic Number Record:");
            Console.WriteLine("Start:     {0}", cal.Start);
            Console.WriteLine("Palindrom: {0}", cal.Palindrom, cal.Steps);
            Console.WriteLine("Steps:     {0}", cal.Steps);
        }
    }
    public static void Test31()
    {
        PalindromCalculator cal = new PalindromCalculator();

        cal.Start = new Number("89");
        cal.Limit = 1000;
        if (cal.CalcPalindrom())
        {
            Console.WriteLine("Start {0} --> {1} steps:  Palindrom {2}",
                              cal.Start, cal.Steps, cal.Palindrom);
        }

        cal.Start = new Number("196");
        cal.Limit = 1000;
        if (!cal.CalcPalindrom())
        {
            Console.WriteLine("Number {0} seems not to generate a palindrom (tried {1} steps) !",
                              cal.Start, cal.Limit);
        }

        cal.Start = new Number("789");
        cal.Limit = 1000;
        if (cal.CalcPalindrom())
        {
            Console.WriteLine("Start {0} --> {1} steps:  Palindrom {2}",
                              cal.Start, cal.Steps, cal.Palindrom);
        }

        cal.Start = new Number("53978");
        if (cal.CalcPalindrom())
        {
            Console.WriteLine("Start {0} --> {1} steps:  Palindrom {2}",
                              cal.Start, cal.Steps, cal.Palindrom);
        }

        cal.Start = new Number("52007615407");
        if (cal.CalcPalindrom())
        {
            Console.WriteLine("Start {0} --> {1} steps:  Palindrom {2}",
                              cal.Start, cal.Steps, cal.Palindrom);
        }

        // may run very very long ......
        cal.Start = new Number("456789900345345");
        cal.Limit = 50000;
        if (!cal.CalcPalindrom())
        {
            Console.WriteLine("Start {0}: No result after {1} steps!",
                              cal.Start, cal.Limit);
        }
        else
        {
            Console.WriteLine("Start {0} --> {1} steps:  Palindrom {2}",
                              cal.Start, cal.Steps, cal.Palindrom);
        }
    }