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”).
%I #51 Nov 25 2023 08:42:10
%S 1,2,3,5,7,4,10,8,11,12,13,14,15,16,18,19,20,22,24,26,27,28,29,30,32,
%T 34,35,36,38,40,41,42,43,44,46,47,48,50,53,55,57,59,65,68,69,70,71,72,
%U 73,74,75,76,79,84,85,86,87,88,89,90,91,92,94,95,96,98,103,107
%N Lexicographically earliest sequence of positive distinct terms such that the a(n)th digit of the sequence is noncomposite (see the Comments section).
%C "Noncomposite" digits are 0, 1, 2, 3, 5 and 7.
%H David Consiglio, Jr., <a href="/A114319/b114319.txt">Table of n, a(n) for n = 1..1000</a>
%e Noncomposite digits are between parentheses:
%e Sequence: 1,2,3,5,7,4,10,8,11,12,...
%e Sequence: (1),(2),(3),(5),(7),4,(1)(0),8,(1)(1),(1)(2),...
%e Digit position: 1st, 2nd, 3rd, 4th, 5th, 7th, 8th, 10th, 11th, 12th, ... = a reordering of the sequence itself.
%o (Python)
%o noncomp = [0, 1, 2, 3, 5, 7]
%o terms = [1, 2, 3, 5, 7, 4, 10, 8]
%o def si(test_list): # all terms greater than 0 and no repetitions
%o a = all(i > 0 for i in test_list)
%o b = len(test_list) == len(set(test_list))
%o return a & b
%o def clear(test_list): # sequence meets definitional criteria
%o full = "".join(str(x) for x in test_list)
%o for a in test_list:
%o if int(a) - 1 >= len(full):
%o return True
%o elif int(full[int(a) - 1]) not in noncomp:
%o return False
%o return True
%o while len(terms) < 100:
%o start = 1
%o while True:
%o terms.append(start)
%o if si(terms) and clear(terms):
%o break
%o else:
%o terms.pop()
%o start += 1
%o print(terms)
%o # _David Consiglio, Jr._, Oct 30 2023
%Y Cf. A114316 (same idea but with "nonprime" digits 0, 1, 4, 6, 8 and 9).
%K nonn,base,easy
%O 1,2
%A _Eric Angelini_, Feb 05 2006
%E Corrected by the author on Feb 24 2020 thanks to _R. J. Mathar_ and _Bernard Schott_