Sum of number's number Hey, I have a number theory problem: determine the sum of the digits of a natural number. I have been thinking about it for a lot time during this days, but I can't still find a solution. Can someone give me an idea or advise me a book/internet site with something useful? Thank a lot. 
Add them up? What are you looking for? 
I can find it modulo 9 no problem. :p 
This seems pretty brute force, wouldn't surprise me at all if there was something more elegant. Let each digit $d_i \in \{0,1,2 \dots , 9\}$ be such that $\displaystyle d_{1}d_{2}d_{3} \dots d_{N} = a \in \mathbb{N}$ (This is concatenation, but also $\displaystyle a= \sum_{i=1}^{N} d_{i}10^{(Ni)}$ ) Then we know $d_1 = floor \left(10^{(N1)}a \right)$ Now, we know $a10^{(N1)}d_{1} = d_{2}d_{3} \dots d_{N}$ thus $d_{2} = floor \left(10^{(N2)} \left(a10^{(N1)}d_{1} \right) \right)$ and $d_{3} = floor \left(10^{(N3)} \left(a10^{(N1)}d_{1}  10^{(N2)}d_{2} \right) \right)$ Continuing this strategy leaves $\displaystyle d_{n} = floor \left( 10^{(Nn)} \left( a  \sum_{i=1}^{n1} d_{i}10^{(Ni)} \right) \right) $ So, the sum of digits should be $\displaystyle \sum_{i=1}^{N}d_{i} = floor \left(10^{(N1)}a \right) + \sum_{n=2}^{N} floor \left( 10^{(Nn)} \left( a  \sum_{i=1}^{n1} d_{i}10^{(Ni)} \right) \right)$ For $N \geq 2$ 
Thanks for your answer. I tried with another different way: Let $\displaystyle d_i \in \{0,1,2 \dots , 9\}$ and $\displaystyle \displaystyle d_{1}d_{2}d_{3} \dots d_{N} = a \in \mathbb{N}$ Now I know that each digit is generated by: $\displaystyle d_i = \sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A\,\, mod\,\, 10^{i}A\,\, mod\,\, 10^{i1}}{10^{i1}}$ I expand the sum and I obtain: $\displaystyle \frac{A\, mod\,\, 10A\,\, mod\,\, 1}{1}+\frac{A\, mod\,\, 10^{2}A\,\, mod\,\, 10}{10}+\cdots +\frac{A\, mod\,\, 10^{i}A\,\, mod\,\, 10^{i1}}{10^{i1}}$ I have to simplify the denominator so: $\displaystyle \frac{1\cdot (A\, mod\,\, 10A\,\, mod\,\, 1)}{1}+\frac{10\cdot (\frac{A}{10}\, mod\,\, 10\frac{A}{10}\,\, mod\,\, 1)}{10}+\cdots +\frac{10^{i1}\cdot (\frac{A}{10^{i1}}\, mod\,\, 10\frac{A}{10^{i1}}\,\, mod\,\, 1)}{10^{i1}}$ I split the term: $\displaystyle A\, \, mod\, \, 10+\frac{A}{10}\, \, mod\, \, 10+\cdots+\frac{A}{10^{i1}}\, \, mod\, \, 10(A\, \, mod\, \, 1+\frac{A}{10}\, \, mod\; 1+\cdots +\frac{A}{10^{i1}}\, \, mod\, \, 1)$ Now I would have picked up $\displaystyle mod\,\,10$ and $\displaystyle mod\,\,1$: $\displaystyle \left (\sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A}{10^{i1}}\right)\, \, mod\, \, 10\left (\sum_{i=1}^{\left \lfloor log_{10}(A)+1 \right \rfloor}\frac{A}{10^{i1}}\right)\, \, mod\, \, 1$; but I can't; some ideas to move forward? Quote:

All times are GMT 8. The time now is 07:49 AM. 
Copyright © 2019 My Math Forum. All rights reserved.