Sum of number's digits

Sum of number's digits

Hi Math.com, I have a particular problem: determine the sum of the digits of an integer. I tried with this method:

-Let $$d_i \in \{0,1,2 \dots , 9\}$$ and $$\displaystyle d_{1}d_{2}d_{3} \dots d_{N} = A \in \mathbb{N}$$

-Now I know that each digit is generated by: $$d_i = \sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A\,\, mod\,\, 10^{i}-A\,\, mod\,\, 10^{i-1}}{10^{i-1}}$$

-I expand the sum and I obtain: $$\frac{A\, mod\,\, 10-A\,\, mod\,\, 1}{1}+\frac{A\, mod\,\, 10^{2}-A\,\, mod\,\, 10}{10}+\cdots +\frac{A\, mod\,\, 10^{i}-A\,\, mod\,\, 10^{i-1}}{10^{i-1}}$$

-I have to simplify the denominator so: $$\frac{1\cdot (A\, mod\,\, 10-A\,\, mod\,\, 1)}{1}+\frac{10\cdot (\frac{A}{10}\, mod\,\, 10-\frac{A}{10}\,\, mod\,\, 1)}{10}+\cdots +\frac{10^{i-1}\cdot (\frac{A}{10^{i-1}}\, mod\,\, 10-\frac{A}{10^{i-1}}\,\, mod\,\, 1)}{10^{i-1}}$$

-I split the term: $$A\, \, mod\, \, 10+\frac{A}{10}\, \, mod\, \, 10+\cdots+\frac{A}{10^{i-1}}\, \, mod\, \, 10-(A\, \, mod\, \, 1+\frac{A}{10}\, \, mod\; 1+\cdots +\frac{A}{10^{i-1}}\, \, mod\, \, 1)$$

-Now I would have picked up $$mod\,\,10$$ and $$mod\,\,1$$: $$\left (\sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A}{10^{i-1}}\right)\, \, mod\, \, 10-\left (\sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A}{10^{i-1}}\right)\, \, mod\, \, 1$$; but I can't; some ideas to move forward?

Thanks
Matteo

Posts: 1
Joined: Wed Jul 03, 2019 1:08 pm
Reputation: 0

Re: Sum of number's digits

It's not clear to me what you are asking. Are you asking for a formula that will give the sum of digits? Would "casting out nines" help?

The digit sum 139 of, say, 139, is, of course, 1+ 3+ 9= 13 which can further be reduced to 1+ 3= 4. 1that 139 divided by 9 is 15 with remainder 4. And the digit sum of 3284 is 3+ 2+ 8+ 4= 17, 1+ 7= 8. While 3284/9= 364 with remainder 8. In general, the remainder when a number is divide by 9 is equal to the repeated digit sum ("repeated" meaning that if the remainder is more than one digit, repeat the sum of digits until you get to one digit).
Guest