I am a beginner in math I was developing a coding problem and here is the pattern which I found: Help me understand the pattern.

Factorial of n will be the sum of all the product of all permutation of digits(1,n-1) taken from 1 to n-1 at a time, with the addition of 1.

I may not sound clear but below is the example. For Example:

factorial 4:
numbers = 1,2,3
factorial 4 = [(1)+(2)+(3)]+[(1x2)+(1x3)+(2X3)]+[(1x2x3)] = 23+1

factorial 5:
numbers = 1,2,3,4
factorial 5 = [(1)+(2)+(3)+(4)]+[(1x2)+(1x2)+(1X3)+(1x4)+(2+3)+(2+4)+(3+4)]+[(1x2x3)+(1x2x4)+(1x3x4)+(2x3x4)]+[(1x2x3x4)] = 119+1

Can we prove this mathematically?


The terms that you supply are the coefficients of the development of the polynomial


i.e. $$x^n+(1+2+3+\cdots n)x^{n-1}+(1\cdot2+1\cdot3+\cdots (n-1)n)x^{n-2}+\cdots+1\cdot2\cdots n.$$ See https://en.wikipedia.org/wiki/Vieta%27s_formulas, https://en.wikipedia.org/wiki/Elementary_symmetric_polynomial and https://en.wikipedia.org/wiki/Falling_and_rising_factorials.

Now, set $x=1$ to get the sum of the coefficients.


Setting $x=-1$ you obtain that the sum with alternating signs is $0$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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