login
A114319
Lexicographically earliest sequence of positive distinct terms such that the a(n)th digit of the sequence is noncomposite (see the Comments section).
2
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, 34, 35, 36, 38, 40, 41, 42, 43, 44, 46, 47, 48, 50, 53, 55, 57, 59, 65, 68, 69, 70, 71, 72, 73, 74, 75, 76, 79, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 95, 96, 98, 103, 107
OFFSET
1,2
COMMENTS
"Noncomposite" digits are 0, 1, 2, 3, 5 and 7.
LINKS
David Consiglio, Jr., Table of n, a(n) for n = 1..1000
EXAMPLE
Noncomposite digits are between parentheses:
Sequence: 1,2,3,5,7,4,10,8,11,12,...
Sequence: (1),(2),(3),(5),(7),4,(1)(0),8,(1)(1),(1)(2),...
Digit position: 1st, 2nd, 3rd, 4th, 5th, 7th, 8th, 10th, 11th, 12th, ... = a reordering of the sequence itself.
PROG
(Python)
noncomp = [0, 1, 2, 3, 5, 7]
terms = [1, 2, 3, 5, 7, 4, 10, 8]
def si(test_list): # all terms greater than 0 and no repetitions
a = all(i > 0 for i in test_list)
b = len(test_list) == len(set(test_list))
return a & b
def clear(test_list): # sequence meets definitional criteria
full = "".join(str(x) for x in test_list)
for a in test_list:
if int(a) - 1 >= len(full):
return True
elif int(full[int(a) - 1]) not in noncomp:
return False
return True
while len(terms) < 100:
start = 1
while True:
terms.append(start)
if si(terms) and clear(terms):
break
else:
terms.pop()
start += 1
print(terms)
# David Consiglio, Jr., Oct 30 2023
CROSSREFS
Cf. A114316 (same idea but with "nonprime" digits 0, 1, 4, 6, 8 and 9).
Sequence in context: A284145 A284189 A373999 * A125151 A372130 A302024
KEYWORD
nonn,base,easy
AUTHOR
Eric Angelini, Feb 05 2006
EXTENSIONS
Corrected by the author on Feb 24 2020 thanks to R. J. Mathar and Bernard Schott
STATUS
approved