login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Underline the k-th digit of a(n), k being the rightmost digit of a(n). This is the lexicographically earliest sequence of distinct terms > 0 such that the succession of the underlined digit is the succession of the sequence's digits themselves.
2

%I #18 Oct 23 2023 18:53:30

%S 1,11,101,111,102,112,121,131,141,151,202,12,161,171,21,181,22,191,

%T 212,31,312,412,41,512,612,51,712,32,302,42,812,52,912,61,1001,1011,

%U 71,1013,62,1021,1031,81,1041,72,82,1051,91,1061,92,1071,122,103,1081,113,1091,201,142,1101,211,242

%N Underline the k-th digit of a(n), k being the rightmost digit of a(n). This is the lexicographically earliest sequence of distinct terms > 0 such that the succession of the underlined digit is the succession of the sequence's digits themselves.

%H John Tyler Rascoe, <a href="/A364326/b364326.txt">Table of n, a(n) for n = 1..10000</a>

%e The rightmost digit of a(1) = 1 is 1: this digit underlines the 1st digit of a(1) which is (1);

%e The rightmost digit of a(2) = 11 is 1: this digit underlines the 1st digit of a(2) which is (1);

%e The rightmost digit of a(3) = 101 is 1: this digit underlines the 1st digit of a(3) which is (1);

%e The rightmost digit of a(4) = 111 is 1: this digit underlines the 1st digit of a(4) which is (1);

%e The rightmost digit of a(5) = 102 is 2: this digit underlines the 2nd digit of a(5) which is (0);

%e The rightmost digit of a(6) = 112 is 2: this digit underlines the 2nd digit of a(6) which is (1); etc.

%e We see that the parenthesized digits at the end of each line reproduce the succession of the original digits.

%t a[1]=1;a[n_]:=a[n]=(k=1;While[If[(f=Mod[k,10])>IntegerLength@k||f==0,True, If[IntegerDigits[k][[f]]!=Flatten[IntegerDigits/@Join[Array[a,n-1],{k}]][[n]],True]]||MemberQ[Array[a,n-1],k],k++];k);Array[a,60] (* _Giorgos Kalogeropoulos_, Jul 19 2023 *)

%o (Python)

%o from itertools import count, filterfalse

%o def check(x):

%o y = str(x)

%o if int(y[-1])> len(y) or y[-1] == '0': return(True)

%o def A364326_list(max_n):

%o A,S,Z,zx = [],set(),'',0

%o for n in range(1,max_n+1):

%o for i in filterfalse(S.__contains__, count(1)):

%o if check(i): S.add(i)

%o else:

%o x = str(i)

%o u = x[int(x[-1])-1]

%o if len(Z) == zx and u == x[0]: break

%o elif u == Z[zx]: break

%o A.append(i); S.add(i); Z += x; zx += 1

%o return(A) # _John Tyler Rascoe_, Oct 23 2023

%Y Cf. A364325.

%K base,nonn

%O 1,2

%A _Eric Angelini_, Jul 18 2023