OFFSET
1,6
COMMENTS
Also number of primes between prime(n) and n. - Joseph L. Pe, Sep 24 2002
Plot the points (n,a(n)) by, say, appending the line ListPlot[%, PlotJoined -> True] to the Mathematica program. The result is virtually a straight line passing through the origin. For the first thousand points, the slope is approximately = 3/4. (This behavior can be explained by using the prime number theorem.) - Joseph L. Pe, Sep 24 2002
Partial sums of A066247, the characteristic function of composites. - Reinhard Zumkeller, Oct 14 2014
Appears to be the same as the coefficient h*_1 of the h* polynomial for polytope representing the number n. See Ya-Ping Lu and Shu-Fang Deng (2020), Table 3.1. - N. J. A. Sloane, Mar 26 2020
LINKS
T. D. Noe, Table of n, a(n) for n=1..1000
Ya-Ping Lu and Shu-Fang Deng, Properties of Polytopes Representing Natural Numbers, arXiv:2003.08968 [math.GM], 2020.
EXAMPLE
Prime(8) = 19 and there are 3 primes between 8 and 19 (endpoints are excluded), namely 11, 13, 17. Hence a(8) = 3.
MATHEMATICA
(*gives number of primes < n*) f[n_] := Module[{r, i}, r = 0; i = 1; While[Prime[i] < n, i++ ]; i - 1]; (*gives number of primes between m and n with endpoints excluded*) g[m_, n_] := Module[{r}, r = f[m] - f[n]; If[PrimeQ[n], r = r - 1]; r]; Table[g[Prime[n], n], {n, 1, 1000}]
Table[n-PrimePi[n]-1, {n, 75}] (* Harvey P. Dale, Jun 14 2011 *)
Accumulate[Table[If[CompositeQ[n], 1, 0], {n, 100}]] (* Harvey P. Dale, Sep 24 2016 *)
PROG
(PARI) { for (n=1, 1000, a=n - primepi(n) - 1; write("b065855.txt", n, " ", a) ) } \\ Harry J. Smith, Nov 01 2009
(Haskell)
a065855 n = a065855_list !! (n-1)
a065855_list = scanl1 (+) (map a066247 [1..])
-- Reinhard Zumkeller, Oct 20 2014
(Python)
from sympy import primepi
def A065855(n):
return 0 if n < 4 else n - primepi(n) - 1 # Chai Wah Wu, Apr 14 2016
CROSSREFS
KEYWORD
easy,nonn,nice
AUTHOR
Labos Elemer, Nov 26 2001
STATUS
approved