login
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.
7
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, 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, 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
OFFSET
1,2
COMMENTS
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.
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.
LINKS
FORMULA
a(n) = 2*A032742(n) + [A286471(n) > 2], a(1) = 1.
EXAMPLE
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.
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.
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.
MATHEMATICA
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 *)
PROG
(Scheme) (define (A286472 n) (if (= 1 n) n (+ (* 2 (A032742 n)) (if (> (A286471 n) 2) 1 0))))
(Python)
from sympy import primefactors, divisors, nextprime
def ok(n): return 1 if isprime(n)==0 and min(primefactors(divisors(n)[-2])) > nextprime(min(primefactors(n))) else 0
def a(n): return 1 if n==1 else 2*divisors(n)[-2] + ok(n) # Indranil Ghosh, May 12 2017
CROSSREFS
Cf. A000040 (primes give the positions of 2's).
Cf. A073490 (one of the matched sequences).
Sequence in context: A318885 A307088 A143112 * A279690 A167272 A090624
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 11 2017
STATUS
approved