Relationship between the product & sum of digits

1.3k Views Asked by At

I was collecting data on 3 particular functions, to find a relationship between them:

  • Let $f(n)$ be the product of all the nonzero digits of a number so that $P(n)$ is the sum of all $f(n)\le n$
  • $S(n)$ is simply the sum of all consecutive integers $\le n$, basically $\cfrac { n(n+1) }{ 2 } $
  • $D(n)$ is the sum of all the digits of all the integers $\le n$

I collected the values of $P(n), D(n), S(n)$ for the powers of 10, thus producing the following results (which can be found here): Graph

Equations:

  • $P(n)=\frac{12167}{25}x−389344$
  • $S(n)=\frac{11001}{2}x-5000000$
  • $D(n)=\frac{37}{2}x-4999$

However, I don't understand the relationships between $P(n)$, $S(n)$, and $D(n)$ shown by the graph, if there is any. Does it have any consequences in number theory?

2

There are 2 best solutions below

0
On

A study along the numerical accumulator D

This study covers just the digit aggregator D:

Let a number $N={ABCDEF}_{(10)}$.

This function is simpler to get compared with $S$, for an obvious reason I used a coefficienal grid in order to match data case by case. for a naive beholder it is clear and well ordered. A progressive analysis of $S$ following the incremental behavior of decimal digits yields to:

enter image description here

If we note that $\sum x$ adds every numeral down or equal to x togather, We can determine the same to $D$.

![enter image description here

Appearently identical when disregarding the coeffecients of $D_1,D_2,...$,but rather if multiplied respectively by them it gives nearly the same amount $S$. If we approximately admit that $D_{n}~=\lfloor\frac{N}{10^{n-1}}\rfloor$, since $N=A10^n+B10^{n-1}...$

$D(N)~=(\sum(9)N+\sum(9)\frac{N}{10}+\sum(9)\frac{N}{100}+...)$ $=\sum(9)N(\frac{1-1/10^n}{9})=5N({1-1/10^n})$

Looking at $S(N)$ it is just $N(N+1)/2$ remarked to be exponentially growing (N multiplied by itself), this means that $S$ will get the other function very lost behind at a serious difference accordingly for bigger $n=log_{10}N$.

If we take $S(N)=(N-\frac{1}{2})^2-\frac{1}{4}$ then $N=\sqrt{S+\frac{1}{4}}+\frac{1}{2}$, which means $D(N)=5(1-\frac{1}{10^{log_{10}N}})(\sqrt{S+\frac{1}{4}}+\frac{1}{2})$. implies $$S=(\frac{D}{5(1-\frac{1}{10^{log_{10}N}})}-\frac{1}{2})^2-\frac{1}{4} \rightarrow_{_{N->\infty}} (\frac{D}{5}-\frac{1}{2})^2-\frac{1}{4} $$.

---- Inspecting even deeper... ---

The error can be further reduced when relating $S$ directly to $D$ without putting $N$ like a proxy between.

$$S~=D(N)+9D(N/10)+90D(N/100)...$$

This is kind of entangled to squeeze out $D(N)$ from $D(N/10^n)$ therefor it is trickier to get $S$ chosen instead.

$$S(N)-9S(N/10)-9S(N/100)...=D(N) ...\ (1)$$

![enter image description here

$S(N)=\frac{N(N-1)}{2}$ means that $S(N)\approx\frac{10^nN/10^n(10^nN/10^n-1)}{2}=10^nS(N/10^n)+\frac{N^2}{2}\frac{10^n-1}{10^n}$ $S(N)\approx 10^nS(N/10^n)+N^2/2$ => $S(N/10^n)=\frac{S(N)-N^2/2}{10^n}$

Replacing this in (1) gives: $D(N)=S(N)-9\frac{S(N)-N^2/2}{10}-9\frac{S(N)-N^2/2}{100}...$

$D(N)=S(N)-9(S(N)-N^2/2)(\frac{1}{10}+\frac{1}{100}+...)$ $=S(N)-9(S(N)-N^2/2)(\frac{(1-1/10^n)}{9})=S(N)-(S(N)-N^2/2)({(1-1/10^n)})$

When $n$ grows sufficiently big, $1/10^n$ reduces infinitesimally thus $D$ gets unconsidered next to $S$.

--- Getting more i's dotted and T's crossed ---

This part where we try to sentence a relational formula between both functions approaching it differently.

If ever decided to narrow down the error, at a stage of trimming out the result mostly as requirable, we can look for a column-by-column accumulation of the function $D$ in details of every decimal digit along all the grid.

enter image description here

Gives:

$D=\sum F+E\sum 9+\sum E+D \sum 9 \frac{10^2-1}{10-1}+\sum D+C \sum 9 \frac{10^3-1}{10-1}+\sum C+B \sum 9 \frac{10^3-1}{10-1}+\sum C+B \sum 9 \frac{10^4-1}{10-1}+\sum B+A \sum 9 \frac{10^5-1}{10-1}+\sum A$

If we took the sum of digits $Sum(Digits)=$ E+D+C+B+A multiplied by 5 equal to the sum of regressive digits $\sum_{min(digits)}^{max(digits)} Sum(i)$, $D$ would be nearly equal to $50\lfloor N/10 \rfloor$:

![enter image description here

Notice that $D$ is N multiplied by a constant, while for $S$, N is squaring itself increasingly!.

0
On

$D(n)$ is simplest when $n=10^k-1,$ consisting of all $9$s. If we want the sum of digits of all the numbers up to $10^k-1$ it is easiest to prepend zeros so every number has $k$ digits. There are then (counting $00000$) $10^k$ numbers, so $k10^k$ digits with an average value of $4.5$, so $D(n)=4.5k10^k$ for $n=10^k-1$

$P(n)$ is also simplest when $n=10^k-1$. Again we extend every number with leading zeros so that it has $k$ digits. Now we go through and replace every $0$ with a $1$. Since you ignored zeros in your product that is equivalent to considering them to be $1$s except we have to decide what to do with $00000$. It will get counted for $1$ here, so we will subtract $1$ at the end. Now we can note that each digit has equal numbers of all the digits except there are twice as many $1$s as the others because of the substitution. The sum of the products is then $46^k$, so $P(n)=46^k-1$ when $n=10^k-1$