A349944 a (1) = 1; a(n) is the smallest number not yet present in the sequence such that the concatenation of a(n-1) and a(n) contains three consecutive descending digits d > e > f.
1, 210, 2, 10, 310, 3, 20, 320, 4, 21, 321, 5, 30, 410, 6, 31, 420, 7, 32, 11, 421, 8, 40, 430, 9, 41, 431, 12, 100, 432, 13, 101, 510, 14, 102, 103, 104, 105, 42, 15, 43, 16, 50, 520, 17, 51, 521, 18, 52, 19, 53, 22, 106, 54, 23, 107, 60, 530, 24, 108, 61
Offset: 1
Examples
a(1) = 1; a(2) = 210, because this is the smallest number not yet present in the sequence which, when concatenated with a(1) = 1 -> 1210, contains three consecutive digits 2 > 1 > 0; a(3) = 2, because this is the smallest number not yet present in the sequence which, when concatenated with a(2) = 210 -> 2102, contains three consecutive digits 2 > 1 > 0; a(4) = 10, because this is the smallest number not yet present in the sequence which, when concatenated with a(3) = 2 -> 210, contains three consecutive digits 2 > 1 > 0.
Programs
-
Python
is_ok = lambda s: any(s[i-2] > s[i-1] > s[i] for i in range(2, len(s))) terms, appears = [1], {1} for i in range(100): t = 1 while t in appears or not is_ok(str(terms[-1]) + str(t)): t += 1 terms.append(t); appears.add(t) print(terms)
Comments