# Thread: Digit sum of extremely large numbers

1. ## Digit sum of extremely large numbers

I figured it out, can't figure out how to delete it, sorry to make a post about nothing.
Last edited by sunde887; 01-26-2011 at 09:08 PM.

2. Moderator
Join Date
Feb 2009
Location
New Zealand
Posts
4,561
Rep Power
11
Roughly speaking n(n+1) will have twice as many digits as n and the resulting exponential growth of the digit length of n! is going to be a problem sooner or later.

Perhaps some number theory is called for.

Some people make a distinction between digit sums and reduced digit sums (ie 456->15 vs 456->6): which do you mean?

 The question was to find the digit sum of 50000!
Last edited by pbrockway2; 01-26-2011 at 10:55 PM.

3. I ended up figuring it out by using big int to string method differently, then I just looped through the produced string, changing each item to an int with parseInt, and finally adding it to sum.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•