#include <limits>
#include <iostream>

unsigned long long pow2( unsigned int n )
{
    if( n >= std::numeric_limits<unsigned long long>::digits ) return 0 ;

    unsigned long long result = 1 ;

    // return result << n ;

    for( unsigned int i=0; i<n; ++i )
    {
        result *= 2 ;
    }

    return result;
}

int main()
{
    for( unsigned int n = 0 ; n < 128; ++n )
    {
        unsigned long long result = pow2(n) ;

        if( result > 0 ) std::cout << "2^" << n << " == " << result << '\n' ;

        else
        {
            std::cerr << "the number 2^" << n
                       << " is too big to be represented by an unsigned long long\n" ;
            return 0 ;
        }
    }
}
