A033271 Number of odd nonprimes <= n.
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19
Offset: 1
Keywords
Programs
-
Mathematica
Insert[Table[Floor[(n + 1)/2] - PrimePi[n] + 1, {n, 2, 80}], 1, 1] (* Stefan Steinerberger, May 09 2006 *) nn=101;With[{nps=Complement[Range[1,nn,2], Prime[Range[PrimePi[nn]]]]}, Table[Count[nps,?(#<=n&)],{n,nn}]] (* _Harvey P. Dale, Mar 23 2011 *) Accumulate[Table[If[OddQ[n]&&!PrimeQ[n],1,0],{n,100}]] (* Harvey P. Dale, Jan 16 2019 *)
Formula
If n>1, then a(n) = floor((n+1)/2) - primepi(n) + 1, where primepi denotes the number of primes <= n a(n)/n is convergent against 0.5. - Stefan Steinerberger, May 09 2006
Extensions
More terms from Stefan Steinerberger, May 09 2006