title: Summing up digits of a very long binary number?
body: <p>I was asked by a friend :</p>
  
  <p>If <code>2^10 = 1024</code>  , we can take 1024 and break and summarize its digits : </p>
  
  <p><code>1+0+2+4 = 7.</code></p>
  
  <p>This is easy.</p>
  
  <p>However When the input is <code>2^30000</code> ( the input actually is a long string <code>"1000..."</code>)  --there is no .net type which can hold this value . </p>
  
  <p>So there must be a trick to sum its digits (digits of the decimal value)....</p>
  
  <p><strong>Edited :</strong></p>
  
  <p>Related trick ( for finding <code>10^20 - 16</code>)</p>
  
  <blockquote>
    <p>100 = 10^2 (one and two zeros) </p>
    
    <p>10^20 = (one and 20 zeros) </p>
    
    <p>hence: </p>
    
    <p>10^20 - 16 = 18 nines, an eight and four. </p>
    
    <p>18*9+8+4 = 174</p>
  </blockquote>
  
  <p>But I haven't succeeded converting this solution to my problem.( I tried quite a lot).</p>
  
  <p>*Im tagging this question as .net because I <em>can</em> use string functions , math functions from .net library.*</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there any trick here which can allow me to sum many many numbers which is the result of <code>x^n</code> ?</p>
  
  <p>What is the trick here ?</p>
  
  <p><strong>Edited #2</strong> : Added the .net2 tag (where biginteger is unavailable)  - I'm wondering how I could do it without biginteger.(i'm looking for the hidden trick)</p>