# Is there a formula for calculating the sum of all products of $p$ different integers $\le n$?

For example:

$n=3, p=2$ then the sum I'm looking for is: $1.2+1.3+2.3$.

Of course this can be easily calculated on a computer. But having a formula would allow me to use it in the derivation of other formulas. So far I've found nothing on the internet.

I have found this nice formula for the sum of all products of arbitrary many distinct integers :

$1+2+3+1.2+1.3+2.3+1.2.3=4!-1=(n+1)!-1$ .

But I would like to be able to separate this into the parts mentioned above. I hope someone can point me in the right direction. Thanks in advance!

$$f(n,1) = \frac{n(n+1)}{2}$$ $$f(n,n) = n!$$ $$f(n,p) = nf(n-1,p-1)+f(n-1,p)$$
If you start with $f(0,0)=1$ and $f(0,p)=0$ for $p \not = 0$ then you can reduce this to just $f(n,p) = nf(n-1,p-1)+f(n-1,p)$; note that you then get $f(n,0)=1$
These are essentially unsigned Stirling numbers of the first kind and you have $f(n,p)=\left[{n+1 \atop n-p}\right]$