# Experiment:-$\sum_{j=1}^{2n+1}(j+1)\left\lfloor {j\cdot j!\over j+1} \right\rfloor$

Experiment of Mathematica to $(1)$

$$\sum_{j=1}^{2n+1}(j+1)\left\lfloor {j\cdot j!\over j+1} \right\rfloor \tag1$$ $\pi(n)$;Prime-counting function

$\lfloor x \rfloor$;Floor function

We spotted a closed form given in term of Prime-counting function $\pi(n)$

We would like to know if it is correct for all values of $n\ge1$

How can we show that $(1)=(2n+2)!-\pi(2n+1)-3$?

Greatly appreciated, if you can help.

Example

$n=1$

$$\sum_{j=1}^{3}(j+1)\left\lfloor {j\cdot j!\over j+1} \right\rfloor=2\lfloor (1/2)\rfloor+3\lfloor (4/3)\rfloor+4\lfloor (18/4)\rfloor=0+3+16=19$$

$19=4!-\pi(3)-3=24-2-3$

where $\pi(3)=2$

• Can you show me what you did in Mathematica (the code you used)? Interesting problem, btw! – Jan Feb 7 '17 at 13:54
• I just used this wolframalpha.com/widget/… – gymbvghjkgkjkhgfkl Feb 8 '17 at 6:16
• Oke, but I dont see in the output something that look like what you stated in your question!! – Jan Feb 8 '17 at 9:46
• I think the calculator reset it self – gymbvghjkgkjkhgfkl Feb 8 '17 at 10:32
• I edited your question in the input button in the link, but I dont get a closed form.....!! – Jan Feb 8 '17 at 12:08

We will use the fact that $\lfloor n+a\rfloor=n+\lfloor a\rfloor$ if $n\in \mathbb{N}$.
We can see that $j\cdot j!=(j+1)!-j!$.Dividing with $j+1$ yields $\frac{j\cdot j!}{j+1}=\frac{(j+1)!}{j+1}-\frac{j!}{j+1}$.
So, the formula takes the form $$\sum_{j=1}^{2n+1}(j+1)\left\lfloor {j\cdot j!\over j+1} \right\rfloor=\sum_{j=1}^{2n+1}(j+1)\left\lfloor\frac{(j+1)!}{j+1}-\frac{j!}{j+1} \right\rfloor,$$ which is equal to $$\sum_{j=1}^{2n+1}(j+1)!-(j+1)\left\lfloor {j!\over j+1} \right\rfloor.$$
If $j+1$ is composite $>4$ then $j+1$ divides $j!$ so $\left\lfloor {j!\over j+1} \right\rfloor=\frac{j!}{j+1}$ which means that $(j+1)\left\lfloor {j!\over j+1} \right\rfloor=j!$.
On the other hand, if $j+1$ is prime then, from Wilson's theorem we know that $j!\equiv -1\pmod{j+1}$ which gives $\left\lfloor {j!\over j+1} \right\rfloor=\frac{j!+1}{j+1}$ and $(j+1)\left\lfloor {j!\over j+1} \right\rfloor=j!+1$.

(This '$1$' left is very important since it occurs for all the $\pi(2n+1)$ primes)

Combining all from above, you can rewrite your sum as $$\sum_{j=1}^{2n+1}(j+1)!-j!-\pi(2n+1)-2.$$ Note that the '$2$' comes because of the special composite $4$ we mentioned.

This sum is a telescoping one and it is equal to $$(2n+2)!-\pi(2n+1)-3.$$

• If $j+1$ is prime, then $$\biggl\lfloor \frac{j!}{j+1}\biggr\rfloor = \frac{j!+1}{j+1} - 1.$$ But since we have the minus sign, we look at $$\biggl\lfloor -\frac{j!}{j+1}\biggr\rfloor = - \biggl\lceil \frac{j!}{j+1}\biggr\rceil.$$ Not sure whether that's a typo or a mistake (two, actually, which cancel) in your answer. – Daniel Fischer Feb 12 '17 at 16:54
• @DanielFischer I don,t get it.The remainder of $(p-1)!$ is $-1$ so $(p-1)!=kp-1$.Why we have an extra $\lfloor \frac{j!}{j+1} \rfloor =\frac{j!+1}{j+1}-1$???There is no typo there I believe... – Konstantinos Gaitanas Feb 12 '17 at 19:20
• Let's take $j = 4$. Then $\frac{j!}{j+1} = \frac{24}{5} = 4 + \frac{4}{5}$, and so $5\bigl\lfloor\frac{4!}{5}\bigr\rfloor = 5\cdot 4 = 4! - 4$, not $4!+1$. However, we're actually looking at $$5\biggl\lfloor \frac{5!}{5} - \frac{4!}{5}\biggr\rfloor = 5\biggl(4! - \biggl\lceil \frac{4!}{5}\biggr\rceil\biggr),$$ and $\bigl\lceil \frac{j!}{j+1}\bigr\rceil = \frac{j!+1}{j+1}$. – Daniel Fischer Feb 12 '17 at 19:27
• @DanielFischer you are right. – Konstantinos Gaitanas Feb 13 '17 at 7:42