%I #18 Jan 02 2023 12:30:50
%S 0,0,0,1,0,1,0,1,1,2,0,2,0,2,1,2,0,2,0,2,1,2,0,2,1,3,2,3,0,3,0,3,2,3,
%T 1,3,0,3,2,3,0,3,0,3,2,3,0,3,1,4,3,4,0,4,2,4,3,4,0,4,0,4,3,4,2,4,0,4,
%U 3,4,0,4,0,4,3,4,1,4,0,4,3,4,0,4,2,4,3,4,0,4,1,4,3,4,2,4,0,4,3,4,0,4,0,4,3,4,0,4,0,4,3,4,0,4,2,4,3,4,1,4,1,5,4,5,3
%N If n = 1 or prime, then a(n) = 0; otherwise, if n is a preprime of k-th kind, then a(n) = k.
%C Preprimes of k-th kind are defined in comment in A247395.
%H Indranil Ghosh, <a href="/A247977/b247977.txt">Table of n, a(n) for n = 1..10000</a>
%H Vladimir Shevelev , <a href="http://list.seqfan.eu/oldermail/seqfan/2014-September/013643.html">A classification of the positive integers over primes</a>
%F If n is a composite number, then a(n) = pi(sqrt(n)) - pi(lpf(n)) + 1, where pi(x) is prime counting function (cf. A000720), lpf = least prime factor (A020639).
%e If n = 15, then, by the formula, we have a(15) = 2 - 2 + 1 = 1.
%t Table[If[n==1 || PrimeQ[n], 0, PrimePi[Sqrt[n]] - PrimePi[FactorInteger[n][[1, 1]]] + 1], {n, 1, 125}] (* _Indranil Ghosh_, Mar 08 2017 *)
%o (PARI) for(n=1, 125, print1(if(n==1 || isprime(n), 0, primepi(sqrt(n)) - primepi(vecmin(factor(n)[, 1])) + 1),", ")) \\ _Indranil Ghosh_, Mar 08 2017
%Y Cf. A000040, A156759, A247393, A247394, A247395, A247396, A247509, A247510, A247511, A247606, A247834, A247835.
%K nonn,look
%O 1,10
%A _Vladimir Shevelev_, Sep 28 2014