A394504
Numbers such that each digit d_i is equal to the number of digits to its right that are strictly less than d_i.
For a number with L digits d_1, d_2, ..., d_L, the rule is d_i = #{j > i : d_j < d_i}.The last digit d_L is always 0 because there are no digits to its right.The first digit d_1 is always between 1 and L-1.Therefore, a number of length L is in the sequence if its digits d_i (for i=0..L-1) satisfy d_0 = L-1, d_{L-1} = 0, and d_i is either 0 or L-1-i for 0 < i < L-1.Thus, each digit describes the 'downward slope' of the remaining digits to its right.
Sequence Chart
Data
0,10,110,200,210,1110,1210,2200,2210,3000,3010,3110,3200,3210,11110,11210,12210,13110,13210,22200,22210,23200,23210,33000,33010,33110,33200,33210,40000,40010,40110,40200,40210,41110,41210,42200,42210,43000,43010,43110,43200,43210
Computational Implementations
PYTHON
def a_list(max_digits):
results = []
def backtrack(current_suffix):
if len(current_suffix) == 1 or current_suffix[0] != 0:
results.append(int("".join(map(str, current_suffix))))
if len(current_suffix) == max_digits:
return
for d in range(10):
count_smaller = sum(1 for x in current_suffix if x < d)
if d == count_smaller:
backtrack([d] + current_suffix)
backtrack([0])
return sorted(results)
print(a_list(5)) Cross-References
See also OEIS entries: Subsequence of A008592.