login
A380300
Lexicographically earliest sequence of positive integers such that any value in the sequence, say v, appears at most twice, and in case v appears twice, then v divides the product of the values surrounded by the two occurrences of v.
0
1, 1, 2, 3, 4, 2, 5, 6, 3, 4, 6, 7, 8, 9, 10, 5, 11, 12, 8, 10, 13, 14, 7, 15, 9, 12, 14, 16, 17, 18, 19, 20, 15, 21, 18, 16, 20, 22, 11, 23, 24, 22, 25, 26, 13, 27, 28, 21, 24, 26, 28, 29, 30, 27, 31, 32, 33, 34, 17, 35, 25, 30, 34, 36, 32, 37, 38, 19, 39, 40
OFFSET
1,3
COMMENTS
Every positive integer appears twice in the present sequence (we can use the same arguments as in A380298).
LINKS
Rémy Sigrist, PARI program
PROG
(PARI) \\ See Links section.
(Python)
from math import prod
from itertools import count, islice
def agen(): # generator of terms
alst, adict, an, m = [], dict(), 1, 1
for n in count(1):
yield an
alst.append(an)
adict[an] = [n] if an not in adict else adict[an] + [n]
an = next(k for k in count(m) if k not in adict or (len(adict[k])==1 and prod(alst[adict[k][0]:n])%k==0))
while m in adict and len(adict[m]) > 1: m += 1
print(list(islice(agen(), 70))) # Michael S. Branicky, Jan 19 2025
CROSSREFS
See A380298 for a similar sequence.
Sequence in context: A243849 A286547 A157000 * A026346 A340791 A369422
KEYWORD
nonn,new
AUTHOR
Rémy Sigrist, Jan 19 2025
STATUS
approved