(This is not an assignment question. It is part of my research, and while solving my case, I come with the following. This analytical thing proves with my simulation. But to write a paper, I need to formalize in generic equation/form)
I will present 3 examples first. Please note that the subtraction is between the first and last digit of any combination. Following is for all $n,k$ (provided $n>k$)
Example 1: $\binom{n}{k} = \binom43 = 4$
So the combinations P is $$P = \{N_{123}, N_{124}, N_{134}, N_{234}\} = \{N_{3-1}, N_{4-1}, N_{4-1}, N_{4-2}\} = \{N_2,N_3,N_3,N_2\}$$
$$P = \{2N_2, 2N_3\}$$
Example 2: $\binom{n}{k} = \binom53 = 10$
So the combinations P is $$P = \{N_{123}, N_{124}, N_{125}, N_{134}, N_{135}, N_{145}, N_{234}, N_{235}, N_{245}, N_{345}\} $$
$$P = \{N_{3-1}, N_{4-1}, N_{5-1}, N_{4-1}, N_{5-1}, N_{5-1}, N_{4-2}, N_{5-2}, N_{5-2}, N_{5-3}\} $$
$$P = \{N_{2}, N_{3}, N_{4}, N_{3}, N_{4}, N_{4}, N_{2}, N_{3}, N_{3}, N_{2}\} $$
$$P = \{3N_2, 4N_3, 3N_4\}$$
Example 3: $\binom{n}{k} = \binom54 = 5$
So the combinations P is $$P = \{N_{1234}, N_{1235}, N_{1245}, N_{1345}, N_{2345}\} $$
$$P = \{N_{4-1}, N_{5-1}, N_{5-1}, N_{5-1}, N_{5-2} \} $$
$$P = \{N_{3}, N_{4}, N_{4}, N_{4}, N_{3}\} $$
$$P = \{2N_3, 3N_4\}$$
Are you asking for a formula for the coefficient in front of $N_r$ in the output of your algorithm? Is so, the answer is $$ (n-r)\binom{r-1}{k-2}. $$ Proof is left as an exercise to the reader. (Hint: the $n-r$ factor accounts for choosing what the smallest element of the subset is).