This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A286472 #16 May 14 2017 00:03:59 %S A286472 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 A286472 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 A286472 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 A286472 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 A286472 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 A286472 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 A286472 Antti Karttunen, <a href="/A286472/b286472.txt">Table of n, a(n) for n = 1..10000</a> %F A286472 a(n) = 2*A032742(n) + [A286471(n) > 2], a(1) = 1. %e A286472 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 A286472 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 A286472 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 A286472 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 A286472 (Scheme) (define (A286472 n) (if (= 1 n) n (+ (* 2 (A032742 n)) (if (> (A286471 n) 2) 1 0)))) %o A286472 (Python) %o A286472 from sympy import primefactors, divisors, nextprime %o A286472 def ok(n): return 1 if isprime(n)==0 and min(primefactors(divisors(n)[-2])) > nextprime(min(primefactors(n))) else 0 %o A286472 def a(n): return 1 if n==1 else 2*divisors(n)[-2] + ok(n) # _Indranil Ghosh_, May 12 2017 %Y A286472 Cf. A032742, A285729, A286471, A286473, A286474, A286475, A286476. %Y A286472 Cf. A000040 (primes give the positions of 2's). %Y A286472 Cf. A073490 (one of the matched sequences). %K A286472 nonn %O A286472 1,2 %A A286472 _Antti Karttunen_, May 11 2017