%I #16 May 14 2017 00:03:59
%S 1,2,2,4,2,6,2,8,6,11,2,12,2,15,10,16,2,18,2,20,15,23,2,24,10,27,18,
%T 28,2,30,2,32,23,35,14,36,2,39,27,40,2,42,2,44,30,47,2,48,14,51,35,52,
%U 2,54,23,56,39,59,2,60,2,63,42,64,27,66,2,68,47,71,2,72,2,75,50,76,22,78,2
%N Compound filter (for counting prime gaps): a(1) = 1, a(n) = 2*A032742(n) + (1 if n is composite and spf(A032742(n)) > nextprime(spf(n)), and 0 otherwise). Here spf is the smallest prime factor, A020639.
%C For n > 1, a(n) is odd if and only if n is a composite with its smallest prime factor occurring only once and with a gap of at least one between the smallest and the next smallest prime factor.
%C For all i, j: a(i) = a(j) => A073490(i) = A073490(j). This follows because A073490(n) can be computed by recursively invoking a(n), without needing any other information.
%H Antti Karttunen, <a href="/A286472/b286472.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = 2*A032742(n) + [A286471(n) > 2], a(1) = 1.
%e For n = 4 = 2*2, the two smallest prime factors (taken with multiplicity) are 2 and 2, and the difference between their indices is 0, thus a(4) = 2*A032742(4) + 0 = 2*(4/2) + 0 = 2.
%e For n = 6 = 2*3 = prime(1)*prime(2), the difference between the indices of two smallest prime factors is 1 (which is less than required 2), thus a(6) = 2*A032742(6) + 0 = 2*(6/2) + 0 = 6.
%e For n = 10 = 2*5 = prime(1)*prime(3), the difference between the indices of two smallest prime factors is 2, thus a(10) = 2*A032742(10) + 1 = 2*(10/2) + 1 = 11.
%t Table[Function[{p, d}, 2 d + If[And[CompositeQ@ n, FactorInteger[d][[1, 1]] > NextPrime[p]], 1, 0] - Boole[n == 1]] @@ {#, n/#} &@ FactorInteger[n][[1, 1]], {n, 98}] (* _Michael De Vlieger_, May 12 2017 *)
%o (Scheme) (define (A286472 n) (if (= 1 n) n (+ (* 2 (A032742 n)) (if (> (A286471 n) 2) 1 0))))
%o (Python)
%o from sympy import primefactors, divisors, nextprime
%o def ok(n): return 1 if isprime(n)==0 and min(primefactors(divisors(n)[-2])) > nextprime(min(primefactors(n))) else 0
%o def a(n): return 1 if n==1 else 2*divisors(n)[-2] + ok(n) # _Indranil Ghosh_, May 12 2017
%Y Cf. A032742, A285729, A286471, A286473, A286474, A286475, A286476.
%Y Cf. A000040 (primes give the positions of 2's).
%Y Cf. A073490 (one of the matched sequences).
%K nonn
%O 1,2
%A _Antti Karttunen_, May 11 2017