storing more than 2 power 31 on a 32-bit system

前端 未结 6 842
别那么骄傲
别那么骄傲 2020-12-09 05:17

I have to write a program that can calculate the powers of 2 power 2010 and to find the sum of the digits. eg:

if `2 power 12 => gives 4096          


        
6条回答
  •  不知归路
    2020-12-09 05:22

    Knowing 2^32, how would you calculate 2^33 with pen and paper?

    2^32 is 4294967296
    
    4294967296
    *        2
    ----------
    8589934592
    
    8589934592 is 2^33; sum of digits is 8+5+8+9+...+9+2 (62)
    

    Just be aware that 2^2011 is a number with more than 600 digits: not that many to do by computer

提交回复
热议问题