login
A397684
Number of n-digit numbers such that, if the digit j occurs, then every digit from 0 to j also occurs.
0
0, 1, 7, 49, 391, 3601, 37927, 451249, 5995591, 88073041, 1381849447, 22012209649, 342462451591, 5107803726481, 72689981888167, 989028944467249, 12924509604552391, 163044766928275921, 1995220493407066087, 23786745463088040049, 277301139700968681991, 3171128127031352793361
OFFSET
1,3
COMMENTS
Equivalently, a(n) is the number of n-digit numbers whose set of decimal digits is {0,1,...,k} for some k, 1 <= k <= 9.
a(n) is the number of n-digit terms of A305701.
For 1 <= n <= 10, a(n) = A343583(n-1). The sequences first differ at n = 11, since decimal notation has only the ten digits 0,1,...,9.
FORMULA
a(n) = Sum_{k=1..9} k*k!*StirlingS2(n,k+1).
EXAMPLE
a(3) = 7, since the 3-digit numbers satisfying the condition are 100, 101, 102, 110, 120, 201, and 210.
MATHEMATICA
a[n_] := Sum[k*k!*StirlingS2[n, k + 1], {k, 1, Min[9, n - 1]}];
Table[a[n], {n, 1, 22}]
CROSSREFS
Cf. A305701 (the numbers being counted), A343583.
Sequence in context: A349781 A199554 A383958 * A343583 A221462 A374855
KEYWORD
nonn,base
AUTHOR
Bartlomiej Pawlik, Jul 05 2026
STATUS
approved