login
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.
0

%I #15 Dec 30 2021 14:38:54

%S 1,210,2,10,310,3,20,320,4,21,321,5,30,410,6,31,420,7,32,11,421,8,40,

%T 430,9,41,431,12,100,432,13,101,510,14,102,103,104,105,42,15,43,16,50,

%U 520,17,51,521,18,52,19,53,22,106,54,23,107,60,530,24,108,61

%N 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.

%C A permutation of the positive integers.

%e a(1) = 1;

%e 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;

%e 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;

%e 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.

%o (Python)

%o is_ok = lambda s: any(s[i-2] > s[i-1] > s[i] for i in range(2, len(s)))

%o terms, appears = [1], {1}

%o for i in range(100):

%o t = 1

%o while t in appears or not is_ok(str(terms[-1]) + str(t)):

%o t += 1

%o terms.append(t); appears.add(t)

%o print(terms)

%Y Cf. A239083, A239137.

%K nonn,base

%O 1,2

%A _Gleb Ivanov_, Dec 06 2021