One can compute the amount of twin primes below a positive integer $n$ by using the Mathematica command (taken from OEIS A001097):
Length[Select[Prime[Range[n]], PrimeQ[# + 2] &]]
The twin prime conjecture states that this value should approach $1.320323632\ldots\times\int_2^n \frac{dt}{\log^2 t}$. So I tried using
N[Integrate[Log[t]^(-2),{t,2,n}]]*1.320323632
However, I got vastly different results than I expected. For instance, for $n=1000$ and $n=10000$ I get, respectively, $45.8\ldots$ and $214.21\ldots$, while the real values are $174$ and $1270$. Obviously, there is something wrong with the Mathematica command above. But what is it?

nmight be better given as(Length[Select[ Prime[Range[n]], (PrimeQ[# - 2] || PrimeQ[# + 2]) && # <= n & ]] + 1)/2. It is necessary to add in the condition# <= n. – JimB Sep 14 '18 at 13:30(Length[Select[ Prime[Range[n]], (PrimeQ[# + 2]) && # <= n & ]] + 1)? – Klangen Sep 14 '18 at 13:44p2[n_] := Length[Select[Prime[Range[PrimePi[n]]], PrimeQ[# + 2] &]]to get the upper bound correct. – Daniel Lichtblau Sep 14 '18 at 14:54# < = npart to your original equation as the item that gives the result you desired. – JimB Sep 14 '18 at 15:14