2^1000 Computing the sum of the digits of a gigantic number

Q: How do you find the sum of the digits of a number that's too large for any native data type?

A: Create an enormous array of integers!
Code on GitHub

//fills an array with zeroes
var A = Array.apply(null,new Array(100)).map(Number.prototype.valueOf,0);

A[0] = 2;

//100,000,000,000,000 - the largest number any individual cell will hold
var MAX  = 100000000000000; 

var n = 1000; //2^n

for (var i = 0; i < (n-1); i++) {

    //First, the value in each cell is doubled.
    for (var k = 0; k < A.length; k++) {
        A[k] = A[k] * 2;
    }

    //Second, the new value in each cell is compared to MAX.
    //If the value is larger than MAX, the most significant digit
    //  is added to the value of the next cell, and is trimmed from the 
    //  value, thus keeping each cell's value below MAX.
    for (var j = 0; j < A.length; j++) {
        if (A[j] > MAX) {
        A[j+1] += Math.floor( A[j] / MAX );
        A[j] = ( A[j] % MAX );
    }
}

//This converts the resulting number to a string
var outputstringA = "";
for (var x = 0; x < A.length; x++) {
    outputstringA += A[A.length-1-x];
}

//This computes the total value of the digits contained within
// the string
var answerA = 0;
for (var y = 0; y < outputstringA.length; y++) {
    answerA += parseInt(outputstringA[y]);
}

console.log(outputstringA, answerA);

So what does 2^1000 look like? Check this number out:

10715086
07186267320948
42504906000181
05614048117055
33607443750388
37035105112493
61224931983788
15695858127594
67291755314682
51871452856923
14043598457757
46985748039345
67774824230985
42107460506237
11418779541821
53046474983581
94126739876755
91655439460770
62914571196477
68654216766042
98316526243868
37205668069376

And the sum of those digits is 1366