Let $p_n$ denote the $n$th prime and $c_n$ the $n$th composite number. Determine all positive integers $n$ such that $|p_n − c_n| = 1$. The only ones with the property in title I could find are $n = 5$ and $n = 6$: $|11 − 10| = 1$  and $|13 − 12| = 1$. Past the $20$th prime, the list of primes grows too fast for composite numbers. Is there more general way to show this?
If $|p_n-c_n| = 1$ then there must exist a $N$ such that the set $\{2,3,\ldots,N\}$ contains an equal number of primes and composite numbers. 

The number of composite numbers in the $N-1$ element set $\{2,\ldots, N\}$ is larger than (numbers divisible by $2$ + numbers divisible by $3$ - numbers divisible by $2\cdot 3$ since these have been counted twice)

$$M = \left\lfloor\frac{N-1}{2}\right\rfloor + \left\lfloor\frac{N-1}{3}\right\rfloor - \left\lfloor\frac{N-1}{6}\right\rfloor - 2$$

where we have subtracted $2$ for the two primes $2$ and $3$.

When $N&gt;25$ we have $M \geq \frac{4N-21}{6} &gt; \frac{N-1}{2} + 1$ so there will always be at least two more composite numbers than prime numbers in the set $\{2,3,\ldots,N\}$ and since $p_{10} = 29 &gt; 25$ it follows that $|p_n-c_n|=1$ has no solutions for $n\geq 10$.
In general $p_n \sim n \ln n$. This can prove useful for your question.