# Calculate $\int_{p}^{p+2} \left \lfloor{\sqrt{x}}\right \rfloor dx,$ for the sequence of the first $100$ prime pairs $(p,p+2)$

This question is only a curiosity, that I asked myself few minutes ago.

Let the arithmetical function $$f(n)=\int_0^n \left \lfloor{\sqrt{x}}\right \rfloor dx,$$ where $\left \lfloor{x}\right \rfloor$ is the floor function satisfying thus $x=\left \lfloor{x}\right \rfloor+\{x\}$, being $\{x\}$ the fractional part function. Thus when $n$ is a positive integer (in fact I've interested only in such case, is a positive integer) then $f(n)$ is a positive integer.

Now for prime pairs $n_k$ and $n_k+2$, that is a prime $n_k=p$ with $p+2$ also a prime number, I am interesting to get the sequence of the first (say $100$) differences $$f(p+2)-f(p).$$

Question. Can you provide us the sequence $$f(n_k+2)-f(n_k)$$ when $1\leq k\leq 100$, with $n_k$ a prime number and $n_k+2$ also a prime number? Thanks in advance.

Curently I have no good abilities in computations with online calculators or computers, thus I am asking this with the purpose to discard a pattern that I've observed in the firsts pairs. Perhaps my question also is not interesting by the values that takes previous arithmetical function. I want to explore it with this exercise.

A quick Mathematica program can generate this sequence:

primelist = Table[Prime[i], {i, 1, 1000}];
twinprimes = Select[primelist, MemberQ[primelist, (# + 2)] &, 100];
Table[Integrate[Floor[Sqrt[x]], {x, i, i + 2}], {i, twinprimes}]

{3, 4, 6, 8, 10, 12, 14, 16, 20, 20, 22, 24, 26, 26, 28, 30, 30, 32,
32, 34, 36, 40, 40, 42, 44, 46, 48, 48, 50, 50, 56, 56, 56, 58, 58,
62, 64, 64, 64, 66, 66, 70, 70, 70, 72, 72, 74, 76, 76, 76, 80, 80,
80, 82, 82, 84, 86, 86, 86, 88, 88, 90, 90, 90, 90, 92, 92, 94, 94,
96, 96, 96, 100, 100, 102, 102, 104, 104, 104, 104, 108, 108, 110,
112, 114, 114, 114, 114, 114, 116, 116, 116, 116, 118, 118, 118, 118,
120, 122, 122}

• Very thanks much, now I see that I was wrong because there are no the sequence $2,4,6,8,10,12,14,16, 18, 20...$ as was my belief. – user243301 Aug 17 '16 at 13:52

As the number between twin primes is never a square ($p+1=m^2$ would imply $p=(m+1)(m-1)$) except for the first twin prime pair, $\lfloor\sqrt x\rfloor$ is constant on $(p,p+2)$. Thus you really just ask for $1+2\sum\lfloor \sqrt p\rfloor$ where $p$ runs over the lower partner of the first 100 prime pairs (that's, $3,5,11,17,29,\ldots,3821$); the $+1$ is to correct for the exceptional case described for the first twin pair. Numerically, the result seems to be $$7237.$$

• Very thanks much, I try understand the translation from the enflish of your answer. Then you say that the patter is obvious or well that there are no such pattern in the cited sequence? – user243301 Aug 17 '16 at 13:51
• Very thanks much I've accepted previous answer, but yours answer is also very valuable. – user243301 Aug 17 '16 at 13:53