16 Power Digit Sum

2^15 = 32768 and the sum of its digits is 3+2+7+6+8=26.3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 2^1000

#include <iostream>
#include <limits>
#include <vector>
#include <math.h>

using namespace std;

void pause() { cin.ignore(numeric_limits<streamsize>::max(), '\n'); }

// For reference, LLONG_MAX = 9223372036854775807 (2^63-1) or greater and
// ULLONG_MAX = 18446744073709551615 (2^64-1) or greater

int main()
{
    unsigned long long int first = pow(2, 63);
    unsigned long long int second = pow(2, 37);
    cout << first << endl;
    cout << second << endl;
    pause();
}

Solution: 1366

Last updated