%I #21 Nov 03 2021 10:51:05
%S 1,2,10,12,13,14,15,16,17,18,19,101,3,121,4,131,5,141,6,151,7,161,8,
%T 171,9,181,21,31,41,51,61,71,81,91,210,191,212,1010,1012,1013,1014,
%U 1015,1016,1017,1018,1019,1210,1212,1213,1214,1215,1216,1217,1218,1219,1310,1312,1313,1314,1315,1316,1317,1318,1319
%N Lexicographically first sequence of distinct positive integers where all the digits "1" are separated by one digit.
%C The sequence is started with a(1) = 1 and always extended with the smallest integer not yet used that does not lead to a contradiction.
%C This is a permutation of all positive integers having every other digit equal to 1, and all other digits different from 1. Here "every other" means either all odd or all even positions, reading either from the left or from the right, Equivalently, a permutation of all numbers that do not have two (or more) consecutive digits equal to 1, or different from 1. None of {11, 110 - 119, 211, 311, ..., 1011, 1100 - 1199, 1211, 1311, ...} nor {20, 22 - 30, 32 - 40, ..., 92 - 100, 102 - 120, ...} will ever appear. - _M. F. Hasler_, Oct 22 2021
%e To match the infinite digit-pattern 1.1.1.1.1.1.1.1.1.1.(etc.) one must use the integer 10 after the second term (which is 2), then use the integer 12 (as 11 is forbidden: no integer with consecutive 1's is allowed), etc.
%o (PARI) is_A276103(n,t=n%10==1)=!while(n\=10,t==(t=n%10==1)&&return) \\ _M. F. Hasler_, Oct 22 2021
%o (PARI) A276103_upto(n, a=0, N=[0,0])={vector(n, i, N[i=2^(a%10==1)]=a=if( a>2, n=10^bittest( logint( a=N[i], 10)+i, 0); my(d); until( d < 9, a += n*if( 9 > d = a\n % 10, 1 + !d, a > 99*n, n *= 100; -9, a=if( i>1, 2080, 10^4)*n\99; break)); a, a<2, i, 10))} \\ _M. F. Hasler_, Oct 31 2021
%o (Python)
%o from itertools import product
%o def eo1(): # generates +ive terms with every other digit 1 and not-1 or v.v.
%o yield from range(1, 10)
%o digits = 2
%o while True:
%o for not1s in product("023456789", repeat=digits//2):
%o yield(int("1" + "1".join(not1s) + "1"*(digits%2)))
%o for first in "23456789":
%o for not1s in product("023456789", repeat=(digits-1)//2):
%o yield(int("1".join((first,)+not1s) + "1"*(digits%2==0)))
%o digits += 1
%o def aupton(terms):
%o alst, aset, astr = [1], {1}, "1"
%o kgen = {True: eo1(), False: eo1()}
%o for n in range(2, terms+1):
%o mustbegin1 = (astr[-1] != "1")
%o k = next(kgen[mustbegin1]); sk = str(k)
%o while k in aset or ((sk[0] == "1") != mustbegin1):
%o k = next(kgen[mustbegin1]); sk = str(k)
%o alst.append(k); aset.add(k); astr += sk
%o return alst
%o print(aupton(64)) # _Michael S. Branicky_, Oct 31 2021
%K nonn,base
%O 1,2
%A _Eric Angelini_, Aug 18 2016