It's all about the sum of the digits The sequence

Given an integer \$n&gt;0\$, we define \$a(n)\$ as the lowest positive integer such that there exists exactly \$n\$ positive integers smaller than \$a(n)\$ whose sum of digits is equal to the sum of the digits of \$a(n)\$.

Edit: this sequence has since been published as A332046

First terms

  n | a(n) | sum of digits | matching integers
----+------+---------------+------------------------------------------------------
  1 |  10  |       1       | [1]
  2 |  20  |       2       | [2, 11]
  3 |  30  |       3       | [3, 12, 21]
  4 |  40  |       4       | [4, 13, 22, 31]
  5 |  50  |       5       | [5, 14, 23, 32, 41]
  6 |  60  |       6       | [6, 15, 24, 33, 42, 51]
  7 |  70  |       7       | [7, 16, 25, 34, 43, 52, 61]
  8 |  80  |       8       | [8, 17, 26, 35, 44, 53, 62, 71]
  9 |  90  |       9       | [9, 18, 27, 36, 45, 54, 63, 72, 81]
 10 | 108  |       9       | [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]
 .. |  ..  |      ..       | ..
 20 | 216  |       9       | [9, 18, 27, 36, 45, 54, 63, 72, 81, 90, ..., 207]
 .. |  ..  |      ..       | ..
 30 | 325  |      10       | [19, 28, 37, 46, 55, 64, 73, 82, 91, 109, ..., 316]
 .. |  ..  |      ..       | ..
 40 | 442  |      10       | [19, 28, 37, 46, 55, 64, 73, 82, 91, 109, ..., 433]
 .. |  ..  |      ..       | ..
 50 | 560  |      11       | [29, 38, 47, 56, 65, 74, 83, 92, 119, 128, ..., 551]


More examples

a(13) = 135
a(17) = 171
a(42) = 460
a(57) = 660
a(81) = 1093
a(82) = 1128
a(118) = 1507
a(669) = 9900
a(670) = 10089
a(1000) = 14552
a(5000) = 80292
a(10000) = 162085


As a side note, you may not assume that the sum of the digits may only increase. For instance, the sum of the digits for \$a(81)\$ is \$1+0+9+3=13\$, while the sum of the digits for \$a(82)\$ is \$1+1+2+8=12\$.

Rules


You may either:


take a 1-indexed integer \$n\$ and return \$a(n)\$
take a 0-indexed integer \$n\$ and return \$a(n+1)\$
take a positive integer \$n\$ and return the \$n\$ first terms
print the sequence indefinitely

This is code-golf!
Pyth, 12 bytes

f}hQ_XsjT;H1


Try it online!


f: Count up from 1 to find the first number such that:
X ... H1: Increment or insert the value 1 into the dictionary H at index
sjT;: sum of base ten digits of current number
_: values of dictionary
}hQ: check whether input + 1 is contained within.


The first time this is true, exactly input numbers must have the same digit sum as the current number, for the first time.