%I #12 Jan 25 2022 15:57:01
%S 2,4,5,5,5,5,5,5,7,7,7,7,7,7,7,7,7,7,7,14,14,14,14,14,14,14,14,14,14,
%T 14,14,14,14,14,14,14,14,19,19,19,19,19,19,19,19,19,19,19,19,22,22,22,
%U 22,22,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
%N Smallest missing number within the first n terms in A095258.
%H Michael De Vlieger, <a href="/A253415/b253415.txt">Table of n, a(n) for n = 2..10000</a> (terms 2..797 from Reinhard Zumkeller)
%t c[_] = 0; c[1] = j = 1; u = 2; s = 3; Reap[Do[d = Divisors[s]; k = 1; While[c[d[[k]]] > 0, k++]; Set[k, d[[k]]]; Set[c[k], i]; If[k == u, While[c[u] > 0, u++]]; Sow[u]; j = k; s += k, {i, 2, 2^12}]][[-1, -1]] (* _Michael De Vlieger_, Jan 23 2022 *)
%o (Haskell)
%o import Data.List (delete)
%o a253415 n = a253415_list !! (n-2)
%o a253415_list = f [2..] 1 where
%o f xs z = g xs where
%o g (y:ys) = if mod z' y > 0 then g ys else x : f xs' (z + y)
%o where xs'@(x:_) = delete y xs
%o z' = z + 2
%o -- _Reinhard Zumkeller_, Dec 31 2014
%o (Python)
%o from itertools import islice
%o from sympy import divisors
%o def A253415_gen(): # generator of terms, first term is a(2)
%o bset, m, s = {1}, 2, 3
%o while True:
%o for d in divisors(s):
%o if d not in bset:
%o bset.add(d)
%o while m in bset:
%o m += 1
%o yield m
%o s += d
%o break
%o A253415_list = list(islice(A253415_gen(),30)) # _Chai Wah Wu_, Jan 25 2022
%Y Cf. A095258, A095259, A253425 (run lengths).
%K nonn
%O 2,1
%A _Reinhard Zumkeller_, Dec 31 2014