SOLUTION. Clearly f(n,x) is the number of combinations with repetition of x+1 elements taken from n−x in n−x. That is,
f(n,x)=CR(x+1,n−x)=((x+1)+(n−x)−1n−x)=(nx)
We will prove that the n sought are all of the form pa with a a positive integer. Let mp be the p-part of the positive integer m, that is, if m=paq (with q≥1 an integer), mp=pa, where a≥1 is an integer. Now we will prove the following preliminary result:
If mp=pa, then (m−i)p=ip for each i∈{1,2,…,pa−1}.
Indeed, if ip=pk then k<a and it is obvious that pk∣(m−i), so ip≤(m−i)p. Conversely, if (m−i)p=pk, it must be that k<a because otherwise pa∣i. Now, pk∣i because pk∣m and pk∣(m−i). That is, (m−i)p≤ip.
Next, we will prove that if p is a prime and n an integer greater than 1. Then p divides (nx) for all x∈{1,2,…,n−1} if and only if n=pa with a an integer.
If p(nx) for all x∈{1,2,…,n−1},p(n1)=n. Setting np=pa, we have:
(npa)=pa(pa−1)…2⋅1n(n−1)…(n−pa+1)
and by the preliminary result, we conclude that the p-part of (npa) is 1, so n=pa.
Conversely, if n=pa, for each x∈{1,2,…,pa−1},
(nx)=x(x−1)…2⋅1pa(pa−1)…(pa−x+1)
and again by the preliminary result, the p-part of (nx) is xppa, which is a multiple of p because x<pa.