%I #31 Jun 23 2024 08:25:04
%S 0,0,0,1,0,2,0,1,1,2,0,2,0,2,2,1,0,2,0,2,2,2,0,2,1,2,1,2,0,3,0,1,2,2,
%T 2,2,0,2,2,2,0,3,0,2,2,2,0,2,1,2,2,2,0,2,2,2,2,2,0,3,0,2,2,1,2,3,0,2,
%U 2,3,0,2,0,2,2,2,2,3,0,2,1,2,0,3,2,2,2,2,0,3,2,2,2,2,2,2,0,2,2,2,0,3,0,2,3
%N a(n)=0 if n is prime, A001221(n) otherwise.
%C Number of prime divisors of n, but excluding n itself if n is prime.
%C Number of non-associated primes in the ring Z_n.
%C Also for n > 1 the number of times n is crossed off in the sieve of Eratosthenes (A000040). - _Reinhard Zumkeller_, Oct 17 2008
%C Number of primes that are proper divisors of n. - _Omar E. Pol_, Dec 27 2008
%H N. J. A. Sloane, <a href="/A087624/b087624.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a> [From _Reinhard Zumkeller_, Oct 17 2008]
%F a(n) = A001221(n) * A005171(n). - _Jason Kimberley_, Nov 19 2014
%F G.f.: Sum_{k>=1} x^(2*prime(k)) / (1 - x^prime(k)). - _Ilya Gutkovskiy_, Apr 13 2021
%F a(n) = omega(n) - c(n), where c = A010051. - _Wesley Ivan Hurt_, Jun 23 2024
%p with(numtheory); f:=proc(n) if isprime(n) then nops(factorset(n))-1 else nops(factorset(n)) fi; end;
%t Array[If[PrimeQ[#],0,PrimeNu[#]]&,110] (* _Harvey P. Dale_, Mar 27 2013 *)
%o (Haskell)
%o a087624 n = if a010051 n == 1 then 0 else a001221 n
%o -- _Reinhard Zumkeller_, Apr 05 2013
%o (PARI) a(n) = if (isprime(n), 0, omega(n)); \\ _Michel Marcus_, Nov 06 2022
%Y Cf. A001221, A010051, A087625.
%Y A144489 gives partial sums.
%K nonn,easy
%O 1,6
%A Michele Dondi (bik.mido(AT)tiscalinet.it), Sep 14 2003
%E Edited by _N. J. A. Sloane_, Dec 11 2008