Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

another sequence on twin primes The maximal prime factor of average of twin prime pair:

n = 100000; averageList = Select[Prime[Range[n]], PrimeQ[# + 2] &] + 1; mpfList = FactorInteger[#][[-1, 1]] & /@ averageList; ListPlot[%]

Why does this diagram look like a series of trajectories? alt text

share|cite|improve this question
Slightly neater: With[{n = 10^5}, ListPlot[Composition[First, Last, FactorInteger] /@ (1 + Select[Prime[Range[n]], PrimeQ[# + 2] &])]]; – J. M. Dec 11 '10 at 9:59
Could you show us this plot for small n (say n<100)? It would help me to be sure of my interpretation of your code, as I'm not as fluent in Mathematica as I used to be. Thanks. – Matthew Conroy Dec 11 '10 at 18:51
Never mind about the plot, if my answer below is sufficient. – Matthew Conroy Dec 11 '10 at 22:50
up vote 1 down vote accepted

The nth twin prime pair appears to be around $c n \log^2 n$ for a constant $c$, large $n$. The largest prime factor of any non-prime $m$ is equal to $n/m'$ where $m'\ge2$. What you see in the plot are approximations of the curves $y=\frac{c}{k} x \log^2 x$ for $k=6,12,24,...$, since the mean of a twin pair is a multiple of 6.

Added: Notice the same effect when plotting simply the maximum prime factor of 6n versus n: alt text

share|cite|improve this answer
Your idea enlightens me. But i think The n-th twin prime pair appears to be around f(n), here n=c f(n) /log^2 f(n) – a boy Dec 12 '10 at 4:32
Correct. I was using $cn\log^2n$ as a quick estimate: I couldn't find a good reference for an easily described approximation to the nth twin primes (my standard references do not have this). For the $n$ in your plot, the nth twin prime pair is roughly $1.5 n \log^2 n$, and my answer explained what you were seeing. – Matthew Conroy Dec 12 '10 at 7:21
$n=cf(n)/\log^2f(n), f(n)=cn\log^2f(n)$.Is it accurate to estimate the n−th twin prime as $cn\log^2n $ ? – a boy Dec 12 '10 at 10:50
An accurate estimate is not necessary to explain the phenomenon you are observing. For small $n$, as in your plot, the nth twin prime, for $500\le n \le 10000$, the nth twin prime is certainly between $1.48 n \log^2 n$ and $1.7 n \log^2 n$. A better estimate appears to be $$f(n)=c n \frac{\log^2 n}{ \log \log n}$$ though I'm still not sure this is the true correct estimate. – Matthew Conroy Dec 12 '10 at 18:04
That should be $$f(n)=\frac{cn \log^2 n}{\log \log \log n}$$ – Matthew Conroy Dec 12 '10 at 19:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.