What is the digit sum of $C(n)$?

254 Views Asked by At

The number $C(n)$ , where $n$ is a positive integer is defined as follows : Write the numbers $j$ from $1$ to $n$ $j$ times. The resulting number is $C(n)$. The letter $C$ comes from the name I invented for these numbers : "Crazy Numbers"

Two examples ($C(8)$ and $C(10)$) including the PARI-routine calculating $C(n)$ :

? s=0;n=8;for(j=1,n,for(k=1,j,s=s*10^length(digits(j))+j));print(s)
122333444455555666666777777788888888
? s=0;n=10;for(j=1,n,for(k=1,j,s=s*10^length(digits(j))+j));print(s)
12233344445555566666677777778888888899999999910101010101010101010
?

Here :

How many digits does $C(n)$ have?

I asked for the number of digits of $C(n)$ (for the definition of $C(n)$, see the link in the linked question), which I finally found out. Another user asked for the digit sum of $C(n)$, and I only can say, if we denote $d(n)$ to be the digit sum of $n$, the digit sum of $C(n)$ is given by $$\sum_{j=1}^n j\cdot d(j)$$

If there would be a formula for $$\sum_{j=1}^n d(j)$$ we could derive the desired digit sum from that.

Does anyone know a concrete formula for $$\sum_{j=1}^n d(j)$$ where $d(n)$ is the digit sum of $n$ ?

1

There are 1 best solutions below

1
On

Consider the digit sum of $C(8) = 122333444455555666666777777788888888$.

We add one copy of $1$ to two copies of $2$ to three copies of $3$ and so on. . . .

In other words $1 + 2^2 + 3^2 + 4^2 + \ldots + 8^2 = \displaystyle \sum_{m=1}^8 m^2$.

In general $C(n)$ has digit sum $\displaystyle \sum_{m=1}^n m^2$.

And there's a formula for that.

The digit sum of $C(n)$ is equal to $\displaystyle \frac{n(n+1)(2n+1)}{6}$