Let k=2021. In fact, we will prove the statement for any integer k>0.
Lemma 1 There exists C>0 independent of k, such that τ(m)≤Cmk+11 holds for all positive integer m, where τ(m) is the number of positive factors of m.
Proof of lemma 1 Let m=p1α1p2α2…prαr be the prime factorization of m. Evidently,
τ(m)=(α1+1)(α2+1)…(αr+1).
Equivalently, there exists C>0 such that
i=1∏rpiαi(αi+1)k+1≤Ck+1
holds for all prime pi and positive integers αi. Note that polynomials grow slower than exponential functions, and hence for each prime p≤2k+1, the fraction pα(α+1)k+1 has an upper bound when α≥0. Since the number of primes p≤2k+1 is finite, there exists C′ such that for any prime p≤2k+1,
pα(α+1)k+1<C′.
On the other hand, for p>2k+1,
pα(α+1)k+1<(2αα+1)k+1<1.
It follows that ∏i=1rpiαi(αi+1)k+1≤C′s, where s is the number of distinct prime factors of m less than 2k+1. The existence of C>0 is now verified.
Lemma 2 For any fixed integer L>0, there exists M>0 such that for any positive integer m≥M, one can find a prime power pα∣m, and pα>L.
Proof of lemma 2 Consider all prime powers less than or equal to L: there are only finitely many of them. Define M equals the product of them plus 1. If m≥M and p∣m, then its highest power in m satisfies pα∣m, and pα>L.
Lemma 3 There exists a positive integer D such that an<2n+D for every positive integer n.
Proof of Lemma 3 We take D satisfying D>max1≤s≤k{as} and
D>2kCk+1+CDk+1k,
where C>0 is defined in Lemma 1, and use induction to prove an<2n+D for every n. By the choice of D, an<2n+D is true for n=1,2,…,k. Assume an<2n+D holds for 1,2,…,n+k−1, where n is a positive integer. Now for an+k, it is known from the problem that an+k is the smallest positive integer not dividing anan+1…an+k−1, and different from a1,…,an+k−1. Hence,
an+k≤τ(anan+1…an+k−1)+n+k.
From Lemma 1 and induction hypothesis, we have
an+k≤C(anan+1…an+k−1)k+11+n+k<C(2(n+k−1)+D)k+1k+n+k<C(2k+1k(n+k)k+1k+Dk+1k)+n+k.
In the last step, we use the fact that xk+1k is concave down for x>0.
Now, if n+k≤2kCk+1, then
an+k<C2k+1k(n+k)k+1k+CDk+1k+n+k≤2kCk+1+CDk+1k+n+k<D+2(n+k);
if n+k>2kCk+1, then
C2k+1k(n+k)k+1k<n+k,CDk+1k<D,
and
an+k≤n+k+D+n+k=2(n+k)+D.
Therefore, an<2n+D is true for n+k.
Return to the original problem. For integer m>0, if m does not appear in the sequence, then, as the elements in {an} are distinct, there must exist a positive integer N1, such that an>m for n>N1. By definition of {an}, m∣anan+1…an+k−1 for all n>N1.
According to Lemma 2, there exists M>0, such that for any integer m≥M, we can find a prime power pα∣m, and pα>(3k)k. We claim that such m must appear in {an}. Suppose to the contrary that for some m>M, m does not appear in {an}. Fix a prime power pα∣m, pα>(3k)k. By the previous argument, there exists a positive integer N1, such that for n>N1,
m∣anan+1…an+k−1.
For this n, there exists i, n≤i≤n+k−1 and p⌈α/k⌉∣ai. Let
N2>3N1+D+3k,
and consider the set A={n:1≤n≤N2,p⌈α/k⌉∣an}. On one hand, from Lemma 3, we have an<2N2+D, and thus
∣A∣≤p⌈kα⌉2N2+D<3k2N2+D.
On the other hand, since m does not appear in {an}, m∣anan+1…an+k−1 for n>N1. Consequently, for any k consecutive terms in {N1+1,N1+2,…,N2}, at least one term belongs to A, implying that ∣A∣≥kN2−N1−1. However, by the choice of N2, we have
∣A∣≥kN2−N1−1>3k2N2+D,
which contradicts the previous estimate. This means all integers m≥M must appear in {an}. □