login
Number of nonprime divisors of n.
29

%I #47 Dec 07 2023 00:17:14

%S 1,1,1,2,1,2,1,3,2,2,1,4,1,2,2,4,1,4,1,4,2,2,1,6,2,2,3,4,1,5,1,5,2,2,

%T 2,7,1,2,2,6,1,5,1,4,4,2,1,8,2,4,2,4,1,6,2,6,2,2,1,9,1,2,4,6,2,5,1,4,

%U 2,5,1,10,1,2,4,4,2,5,1,8,4,2,1,9,2,2,2,6,1,9,2,4,2,2,2,10,1,4,4,7,1,5,1,6

%N Number of nonprime divisors of n.

%H Ray Chandler, <a href="/A033273/b033273.txt">Table of n, a(n) for n=1..100000</a>

%F a(n) = A000005(n) - A001221(n).

%F a((n)) = n and a(m) <> n for m < A055079(n). - _Reinhard Zumkeller_, Dec 16 2013

%F G.f.: Sum_{k>=1} (x^k - x^prime(k))/((1 - x^k)*(1 - x^prime(k))). - _Ilya Gutkovskiy_, Jan 17 2017

%F Dirichlet g.f.: zeta(s)*(zeta(s)-primezeta(s)). - _Benedict W. J. Irwin_, Jul 11 2018

%F Sum_{k=1..n} a(k) ~ n*log(n) - n*log(log(n)) + (2*gamma - 1 - B)*n, where gamma is Euler's constant (A001620) and B is Mertens's constant (A077761). - _Amiram Eldar_, Nov 27 2022

%t Table[Length[Select[Divisors[n], ! PrimeQ[#] &]], {n, 104}] (* _Jayanta Basu_, May 23 2013 *)

%t Table[DivisorSigma[0, n] - PrimeNu[n], {n, 100}] (* _Vincenzo Librandi_, May 17 2017 *)

%t Table[Count[Divisors[n],_?CompositeQ],{n,110}]+1 (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jun 11 2019 *)

%o (Haskell)

%o a033273 = length . filter ((== 0) . a010051) . a027750_row

%o -- _Reinhard Zumkeller_, Dec 16 2013

%o (PARI) a(n) = numdiv(n) - omega(n); \\ _Michel Marcus_, Apr 28 2016

%o (Magma) [NumberOfDivisors(n) - #PrimeDivisors(n): n in [1..150]]; // _Vincenzo Librandi_, May 17 2017

%Y Cf. A000005, A001221, A010051, A027750.

%Y Cf. A055079, A059992, A180040.

%Y Cf. A001620, A077761.

%K nonn

%O 1,4

%A _N. J. A. Sloane_

%E More terms from _Reinhard Zumkeller_, Sep 02 2003

%E Corrected error in offset. - _Jaroslav Krizek_, May 04 2009

%E Extended by _Ray Chandler_, Aug 07 2010