OFFSET
1,6
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 1, 2 and 3, which are all noncomposite numbers, a(n) = 0.
For n = 4 = 2*2 = prime(1)*prime(1), the difference 1-1 = 0, plus one is 1, thus a(4) = 1.
For n = 6 = 2*3 = prime(1)*prime(2), the difference 2-1 = 1, plus one is 2, thus a(6) = 2.
MATHEMATICA
Table[If[Length@ # < 2, 0, First@ Differences@ PrimePi@ Take[#, 2] + 1] &@ Flatten[FactorInteger[n] /. {p_, e_} /; p > 0 :> ConstantArray[p, e]], {n, 118}] (* Michael De Vlieger, May 12 2017 *)
PROG
(Scheme) (define (A286471 n) (if (or (= 1 n) (= 1 (A001222 n))) 0 (+ 1 (- (A055396 (A032742 n)) (A055396 n)))))
(Python)
from sympy import primepi, isprime, primefactors, divisors
def a049084(n): return primepi(n)*(1*isprime(n))
def a055396(n): return 0 if n==1 else a049084(min(primefactors(n)))
def a(n): return 0 if n==1 or isprime(n) else 1 + a055396(divisors(n)[-2]) - a055396(n) # Indranil Ghosh, May 12 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 11 2017
STATUS
approved