Sum of number's digits

Sum of number's digits

Postby Matteo » Wed Jul 03, 2019 1:33 pm

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

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

-Now I know that each digit is generated by: [tex]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}}[/tex]

-I expand the sum and I obtain: [tex]\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}}[/tex]

-I have to simplify the denominator so: [tex]\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}}[/tex]

-I split the term: [tex]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)[/tex]

-Now I would have picked up [tex]mod\,\,10[/tex] and [tex]mod\,\,1[/tex]: [tex]\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[/tex]; but I can't; some ideas to move forward?

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

Re: Sum of number's digits

Postby Guest » Sat Aug 24, 2019 9:00 am

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).

Return to Number Theory

Who is online

Users browsing this forum: No registered users and 2 guests