When is $a(n)$ prime?

Question: When is $$a(n)\in P$$ compared to all possible values of $$n$$? where $$P$$ denotes the set of primes. What is the density of the primes in the sequence?

Consider the sum of the prime counting function.

$$a(n)=\sum_{k=1}^{n} \pi(k)$$

Let $$S(n)$$ be a string of length $$n$$, then $$a(n)$$ is the number of substrings of $$S(n)$$ with a prime number of characters. Example $$1$$: "$$abcd$$" is a string of length $$4$$; there are $$a(4)=5$$ substrings with a prime number of characters $$(ab, bc, cd, abc, bcd)$$. Example $$2$$: "$$abcde$$" is a string of length $$5$$; there are $$a(5)=8$$ substrings with a prime number of characters $$(ab, bc, cd, de, abc, bcd, cde, abcde)$$.

What I'm asking is, when is the number of substrings of $$S(n)$$ with a prime number of characters itself prime?

• Do you have any idea on where to start ? Have you tried to look at the values such that this property is realized at least in the first 100 integers ? – Gâteau-Gallois Apr 20 at 20:24
• As a start one might consider the asymptotic growth of $f(x)=\sum\limits_{n=1}^x b(n)$ where $b(n)=\begin{array}{cc} \{ & \begin{array}{cc} 1 & a(n)\in \mathbb{P} \\ 0 & \text{True} \\ \end{array} \\ \end{array}$ and $a(n)=\sum\limits_{k=1}^n\pi(k)$. For small ranges of $x$, $f(x)$ seems to evaluate fairly closely to $\frac{x}{\log(x)}$. – Steven Clark Apr 20 at 22:13