Using BigInteger this time felt like (and probably was) cheating. Euler problem 16 asks for the sum of the digits of 21000. Finding the sum of the digits of any number n can be solved with a trivial algorithm so long as n is less than 264, a condition that 21000 clearly violates. Of course, the trivial algorithm can be applied to any integer expressed not as an integral value but as a BitInteger object, and this is what I chose to do.

I'll check the forums for more elegant solutions, but this one worked and, because whoever wrote System.Numerics.BigInteger was a much better programmer than I, worked much faster than anything I could have written.

using System;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Problem016
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger hugePower = new BigInteger(Math.Pow(2, 1000));
            string hugePowerOfTwo = hugePower.ToString();
            int result = 0;

            foreach (char c in hugePowerOfTwo)
                result += Int32.Parse(c.ToString());

            Console.WriteLine("The sum of all digits of 2 to the 1,000th is {0}", result);
        }
    }
}