# When does $\sum_a^b k | \prod_a^b k$?

When does the sum $$\sum_a^b k$$ of $$b-a+1$$ consecutive positive integers divide the product $$\prod_a^b k$$?

I know that the sum of the first $$n$$ natural numbers divides the product of the first $$n$$ natural numbers for all $$n$$ except when $$n=p-1$$, $$p$$ being any odd prime. But what about the more general case?

I tried a number of the particular cases, but from there it seems not clear how the general case would look like.

• You can rewrite it as asking when $\frac{(b+a)(b-a+1)}{2}$ divides $\frac{b!}{(a-1)!}$ and then maybe make some progress with Legendre's formula which will turn it into asking when this inequality is satisfied for each prime divisor $p$: $$\frac{b-a+1+s_p(a-1)-s_p(b)}{p-1} \ge v_p(b+a)+v_p(b-a+1)-v_p(2)$$ Jun 26 at 17:28
• Do you have any reason to believe that this would have an easy characterization? Jun 26 at 19:24
• @ Merosity, would you do that? Sep 17 at 3:35

This is a partial answer. Let $$f(a,b):=\bigg(\prod_{k=a}^bk\bigg)/\bigg(\sum_{k=a}^bk\bigg)=\frac{2\times b(b-1)\cdots a}{(b-a+1)(a+b)}.$$

This answer proves the following claims :

Claim 1 :

• $$f(2,b)$$ is an integer for all $$b$$ except when $$b=4,7,p-2$$ where $$p\geqslant 5$$ is an odd prime.

• $$f(3,b)$$ is an integer for all $$b$$ except when $$b=7,p-3$$ where $$p\geqslant 7$$ is an odd prime.

• $$f(4,b)$$ is an integer for all $$b$$ except when $$b=5,10,p-4$$ where $$p\geqslant 11$$ is an odd prime.

Claim 2 : If $$(b-a)$$ is even, then $$f(a,b)$$ is an integer for all $$(a,b)$$ except when $$b-a+1$$ is a prime number satisfying $$a+b\equiv 0\pmod{b-a+1}$$.

Claim 3 : If $$(b-a)$$ is odd, then it is necessary that $$(a+b)\mid ((b-a)!!)^2$$, and it is sufficient that $$(a+b)\mid \bigg(\dfrac{b-a-1}{2}\bigg)!(b-a)!!$$.

Claim 4 :

• $$f(a,a+1)$$ is not an integer.

• $$f(a,a+3)$$ is an integer if and only if $$a=3$$.

• $$f(a,a+5)$$ is an integer if and only if $$a=5,10,35$$.

Claim 5 : If $$d\ (\geqslant 3)$$ is a proper divisor of an odd composite number $$a+b$$ with $$b\geqslant \dfrac{2d+1}{d-1}a+d$$, then $$f(a,b)$$ is an integer.

Claim 1 :

• $$f(2,b)$$ is an integer for all $$b$$ except when $$b=4,7,p-2$$ where $$p\geqslant 5$$ is an odd prime.

• $$f(3,b)$$ is an integer for all $$b$$ except when $$b=7,p-3$$ where $$p\geqslant 7$$ is an odd prime.

• $$f(4,b)$$ is an integer for all $$b$$ except when $$b=5,10,p-4$$ where $$p\geqslant 11$$ is an odd prime.

Proof :

• One has $$f(2,b)=2b\times\dfrac{(b-2)!}{b+2}$$ with $$f(2,4)=\dfrac 83$$ and $$f(2,7)=186+\dfrac{2}{3}$$. If $$b+2=2M\ (\geqslant 8)$$ is even, then $$b-2=M+(M-4)\geqslant M$$. Since the product of $$M$$ consecutive integers is divisible by $$M$$, $$(b-2)!$$ is divisibe by $$M$$. If $$b+2$$ is an odd prime, then $$f(2,b)$$ is not an integer. If $$b+2=PQ$$ is an odd composite number where $$3\leqslant P\leqslant Q$$ and $$(P,Q)\not=(3,3)$$, then $$b-2-(P+Q)=(P-1)(Q-1)-5\geqslant 0$$, i.e. $$b-2\geqslant P+Q$$, so $$(b-2)!$$ is divisible by $$PQ$$.

• One has $$f(3,b)=b(b-1)\times\dfrac{(b-3)!}{b+3}$$ with $$f(3,5)=5,f(3,6)=20$$ and $$f(3,7)=100+\dfrac 45$$. If $$b+3=2M\ (\geqslant 12)$$ is even, then $$b-3=M+(M-6)\geqslant M$$, so $$(b-3)!$$ is divisible by $$M$$. If $$b+3$$ is an odd prime, then $$f(3,b)$$ is not an integer. If $$b+3=PQ$$ is an odd composite number where $$3\leqslant P\leqslant Q$$ and $$(P,Q)\not=(3,3)$$, then $$b-3-(P+Q)=(P-1)(Q-1)-7\geqslant 0$$, i.e. $$b-3\geqslant P+Q$$, so $$(b-3)!$$ is divisible by $$PQ$$.

• One has $$f(4,b)=\dfrac{b(b-1)(b-2)}{3}\times\dfrac{(b-4)!}{b+4}$$ with $$f(4,5)=\dfrac{20}{9}$$, $$f(4,6)=8,$$ $$f(4,8)=224,$$ $$f(4,10)=12342+\dfrac{6}{7}$$ and $$f(4,11)=110880$$. If $$b+4=2M\ (\geqslant 16)$$ is even, then $$b-4=M+(M-8)\geqslant M$$, so $$(b-4)!$$ is divisible by $$M$$. If $$b+4$$ is an odd prime, then $$f(4,b)$$ is not an integer. If $$b+4=PQ$$ is an odd composite number where $$3\leqslant P\leqslant Q$$ and $$(P,Q)\not=(3,3),(3,5)$$, then $$b-4-(P+Q)=(P-1)(Q-1)-9\geqslant 0$$, i.e. $$b-4\geqslant P+Q$$, so $$(b-4)!$$ is divisible by $$PQ$$.$$\quad\blacksquare$$

Claim 2 : If $$(b-a)$$ is even, then $$f(a,b)$$ is an integer for all $$(a,b)$$ except when $$b-a+1$$ is a prime number satisfying $$a+b\equiv 0\pmod{b-a+1}$$.

Proof : If $$b-a=2m$$ where $$m$$ is a positive integer, then $$f(a,a+2m)=\frac{\overbrace{(a+2m)\cdots (a+m+1)}^{m\ \text{consecutive integers}}\ \overbrace{(a+m-1)\cdots a}^{m\ \text{consecutive integers}}}{2m+1}$$Note here that for every pair $$(s,t)$$ satisfying $$0\leqslant s\lt t\leqslant 2m$$, $$a+s\not\equiv a+t\pmod{2m+1}$$.

• If $$a+m\not\equiv 0\pmod{2m+1}$$, then $$f(a,a+2m)$$ is an integer.

• If $$a+m\equiv 0\pmod{2m+1}$$, and $$2m+1$$ is a prime number, then $$f(a,a+2m)$$ is not an integer.

• If $$2m+1$$ is a composite number, then there are integers $$P,Q$$ such that $$2m+1=PQ$$ and $$3\leqslant P\leqslant Q$$ for which $$m-P\geqslant m-Q=\dfrac{Q(P-2)-1}{2}\geqslant 0$$ holds, so $$f(a,a+2m)$$ is an integer.$$\quad\blacksquare$$

Claim 3 : If $$(b-a)$$ is odd, then it is necessary that $$(a+b)\mid ((b-a)!!)^2$$, and it is sufficient that $$(a+b)\mid \bigg(\dfrac{b-a-1}{2}\bigg)!(b-a)!!$$.

Proof : If $$b-a=2m+1$$ where $$m$$ is a non-negative integer, then one has $$f(a,a+2m+1)=\frac{(a+2m+1)(a+2m)\cdots a}{(m+1)(2a+2m+1)}$$

Multiplying the both sides by $$2^{2m+2}(m+1)$$ gives $$2^{2m+2}(m+1)f(a,a+2m+1)=\frac{(2a+4m+2)(2a+4m)\cdots 2a}{2a+2m+1}$$ Now since \begin{align}(\text{the numerator})&\equiv (2m+1)(2m-1)\cdots (-2m-1)\pmod{2a+2m+1} \\\\&\equiv (-1)^{m+1}((2m+1)!!)^2\pmod{2a+2m+1}\end{align} So, it is necessary that $$(2a+2m+1)\mid ((2m+1)!!)^2$$.

Also, since the product of $$N$$ consecutive integers is divisible by $$N!$$, there is an integer $$k$$ such that $$f(a,a+2m+1)=\frac{k\cdot (2m+2)!}{(m+1)(2a+2m+1)}=\frac{2^{m+1}k\cdot m!(2m+1)!!}{2a+2m+1}$$from which one can say that it is sufficient that $$(2a+2m+1)\mid m!(2m+1)!!$$.$$\quad\blacksquare$$

Claim 4 :

• $$f(a,a+1)$$ is not an integer.

• $$f(a,a+3)$$ is an integer if and only if $$a=3$$.

• $$f(a,a+5)$$ is an integer if and only if $$a=5,10,35$$.

Proof :

• From Claim 3, it is necessary that $$2a+1\mid 1$$ which is impossible.

• From Claim 3, it is necessary that $$2a+3\mid 3^2$$ implying $$a=3$$ which is sufficient.

• From Claim 3, it is necessary that $$2a+5\mid 3^2\cdot 5^2$$ implying $$a=2,5,10,20,35,110$$, and only $$a=5,10,35$$ are sufficient.$$\quad\blacksquare$$

Claim 5 : If $$d\ (\geqslant 3)$$ is a proper divisor of an odd composite number $$a+b$$ with $$b\geqslant \dfrac{2d+1}{d-1}a+d$$, then $$f(a,b)$$ is an integer.

Proof : If $$b-2a+1\geqslant d+\dfrac{a+b}{d}$$, i.e. $$b\geqslant \dfrac{2d+1}{d-1}a+d$$, then since $$f(a,b)=\frac{2\times b(b-1)\cdots (b-a+2)\overbrace{(b-a)(b-a-1)\cdots a}^{(b-2a+1)\ \text{consecutive integers}}}{a+b}$$ one can see that $$a+b=d\cdot\dfrac{a+b}{d}$$ divides $$(b-a)(b-a-1)\cdots a$$.$$\quad\blacksquare$$

• That is quite an effort. Sep 19 at 15:50
• Although, as you know, your answer is not complete. The effort is appreciable. I am awarding this bounty to you. Sep 22 at 4:07