Qm

The sum of all digits from 1 to a million

Every whole number from 1 to 1,000,000 is written out, and all the individual digits are added together.

What is the total? Find a method that avoids any long addition, and be careful with the endpoint.

Show a hint

Pad to six digits and consider 000000 to 999999. Each digit position takes each value 0 to 9 equally often. Then add the digits of 1,000,000.

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

Add up every digit from 1 to 999Ants on a triangleThe book that took 792 digits to numberWhen can the hands swap places and still show a real time?How many times is the digit 1 written from 1 to 1000?
All questions →