Consider number of twin primes less than $x$. We know that this number less than $\frac{Cx}{\log^2 x}$ for some constant $C$. 


Denote by $p\_n$ the $n$-th prime number. Do we have the same result about number of prime numbers $p\_n<x$ such that $p\_{n+1} - p\_n < D$ for some constant $D$?



Number of twin primes
Yes, and this can be proved in the same way, e.g. by the large sieve or the Selberg sieve. Of course, the constant $C$ will depend on $D$.


For a lower bound (for $D=248$ at the moment), see my response to [this question](https://mathoverflow.net/questions/176875/lower-bound-for-a-prime-gap-occurring-infinitely-often).


**Added 1.** As GuestPoster pointed out to me, the upper bound $Z(x)\ll x/\log^2 x$ for the number of twin primes up to $x$ was already established by Brun. His original paper is available [here](https://archive.org/details/lecriblederatost00brun). In fact Brun shows $Z(x)<100x/\log^2 x$ for $x>x\_0$, see the last display (37) in the paper. No doubt Brun's method works equally well for the original question above, with $100$ being replaced by an effective constant depending on $D$.


**Added 2.** J. R. Chen proved in his paper "On Goldbach's problem and the sieve methods" (Sci. Sinica Ser. A 21 (1978), 701-738.) that the number of solutions of $P-P'=h$ in primes $P'<P<x$ is less than
$$ 7.8342\times \prod\_{p>2}\left(1-\frac{1}{(p-1)^2}\right)\prod\_{\substack{p>2\\p\mid h}}\left(1+\frac{1}{p-2}\right)\times\frac{x}{\log^2 x},$$
assuming $x$ is sufficiently large in terms of $h$.
I learned this from a paper of Pintz and Ruzsa (Acta Arith. 109 (2003), 169-194.).


