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.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
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
(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
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 11 2017
STATUS
approved