I need to calculate total possible ways of representing $n!$ as a sum of two or more consecutive positive integers.
Example : $3!=1*2*3=6$ and $6=1+2+3$ the only one possible way.
Answer : $1$
The approach I followed is as follows:
Let $p≤N$ be a prime. The highest power of $p$ dividing $N$ is given by $α_p=\sum_{k=1}^{\infty} \lfloor \frac{N}{p^k} \rfloor$
so $N! = 2^{\alpha_2}3^{\alpha_3}5^{\alpha_5} \ldots p^{\alpha_q}$ where $q$ the last prime $\leq N$
We want $N!=a+(a+1)+(a+2)+(a+3)+\ldots +(a+n)=\frac{(2a+n)(n+1)}{2}$ where $a,n\ge 1$ where $a,n \in \mathbb{I} $
Hence equating the above two equations we get, $2^{\alpha_2}3^{\alpha_3}5^{\alpha_5} \ldots p^{\alpha_q}=\frac{(2a+n)(n+1)}{2}$
So finally , $2^{(\alpha_2+1)}3^{\alpha_3}5^{\alpha_5} \ldots p^{\alpha_q}={(2a+n)(n+1)}$ , for the above examle $2^2 3^1=(2*2+2)(2+1)$ so $a=2$ and $n=2$
I am not able to proceed further because brute force solution is just not enough.I found the similar question but the solutions provided are not leading to exact solution of the problem.How do I solve the problem?
We have
$$a=\frac{N!}{n+1}-\frac{n}{2}$$
So, you can find the solutions as follows :
Since the divisors of a factorial can be determined efficiently, this method solves the problem efficiently.