Calculation of digits

43 Views Asked by At

Suppose that an array of numbers from $1$ to $10^{23}$ is given. Let's calculate the sum of digits of each number. What kind of numbers among them are more with a $3$-digit sum or a $2$-digit sum? Please give me detailed explanation, because I do not have any idea how to approach this task.

1

There are 1 best solutions below

5
On

Hints:

  • It would be easier to look at numbers from $0$ through to $10^{23}-1$, though this makes minimal difference
  • How many digits does the largest number have? What is the largest possible digit sum?
  • What is the average digit sum (you can include leading zeros if it helps)? Can you pair numbers with digit sums below this with numbers with digit sums above this? What is the median digit sum? What is the answer to the original question?