Is this still a challenge if you found a sequence on OEIS? Edit: I didn’t look at the sequence, but tried deriving it myself. I came up with something equivalent, though the formula on OEIS seems somewhat shorter.
After some manual inspection of such base-digit-sequences, I came up with an expression for the length L of the string of concatenated digits in base b from 1 to the largest number with n digits:
T(b,n) = \frac{1-b^n-nb^n+nb^{n+1}}{b-1}
So, for example, there are T(5,2) = 44 characters in the string “12341011121314202122232430313233344041424344” and T(3,3) = 68 characters in the string “12101112202122100101102110111112120121122200201202210211212220221222”.
To find the length S of the string for an arbitrary number N in base b, we first need to know the number of digits d for that number, which is given by:
d = \lfloor\log_b N\rfloor + 1
The length of the string is shortened by (N_\text{max}-N)d digits, where N_\text{max} is the largest number with d digits, N_\text{max} = b^d-1.
We finally have,
S(N,b,d) = T(b,d) - (b^d-1-N)d
Or, to match your definition of concat_consec_digits_count
, we have after some simplification and rearrangement:
S(N,b) = N+(N+1)\lfloor\log_bN\rfloor+\frac{b\left(1-b^{\lfloor\log_bN\rfloor}\right)}{b-1}
It’s easy to verify that S(23,12) = 35 and S(12,5)=20 as in your examples.