Sum digits of 2^p with p<=10.000.000

Revision en1, by I_LOVE_ROMANIA, 2019-11-30 13:26:39

Hey guys! My professor proposed me to solve this problme. Given a number p <= 10^7, print the sum of the digits of 2^p. For exemple, 2^4 = 16 so we'll print 7. How can I do this properly? I first tried to use in a way or in another, the little theorem of fermat but it made no sense here.

Tags #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English I_LOVE_ROMANIA 2019-11-30 13:26:39 324 Initial revision (published)