Average of near-diagonal numbers

Consider all 1010-digit numbers d9d8⋯d1d0‾\overline{d_9 d_8 \cdots d_1 d_0} (so d9≠0d_9 \ne 0) whose digits satisfy ∣di−i∣≤1|d_i - i| \le 1 for every position i∈{0,1,…,9}i \in \{0, 1, \dots, 9\}. What is the average of all such numbers?

Show hints (2)+
  1. The constraint is per-position, so valid numbers form a product set - average each digit independently, weighted by 10i10^i.
  2. Interior digits average to ii; the boundaries clip to dˉ0=0.5\bar d_0 = 0.5 and dˉ9=8.5\bar d_9 = 8.5.

Answer

Reveal answer →

9376543210.5

Create a free account to see the full worked solution and track your progress.

Interview format: Market Maker, Systematic & Data-Driven Trading

Related questions