count increasing functions on natural numbers. I want to count all functions with these two conditions:
it is from {1,2,....,7} to {1,2,....,5}.
it is increasing .
I have some idea to start with f(1) different values but do not know how to organize solution.
 A: The string of values of such a function can be written uniquely as $$1^a2^b3^c4^d 5^e$$ where the $5-$ tuple $(a,b,c,d,e)$ of non-negative integers sums to $7$.  A routine application of Stars and Bars tells us that there are $$\binom {5+7-1}{7}=330$$ of these.
A: Let $x_n=f(n)$, then we want the number of tuples $(x_1,\dots,x_7)$ such that $$1\leq x_1\leq\dots\leq x_7\leq5.$$
We can regard this as the number of ways to split $7$ balls into $5$ bins, which is $\binom{7+5-1}{7}=330$.
A: *

*If $\color{red}{|{\rm range}(f)|=5}$
Some consecutive elements must take the same value. So we have the following possiblities:

*

*If $3$ consecutive elements take the same value then you have such situation $$*,*, (*,*,*),*,*$$ (elements in the bracket take the same value, in this case $3$, $4$ and $5$ takes value $3$) and that is ${5!\over 4!1!}=5$ possibilities.


*If two times $2$ consecutive elements take the same value, then you have such situation $$*,(*,*),*,(*,*),*$$ and that is ${5!\over 3!2!}=10$ possibilities.
So in this case there is $15$ such functions.

*

*If $\color{red}{|{\rm range}(f)|=4}$
Then some we have to take from codomain 1 element, that we can do on $5$ ways. Some elements take the same value so we have $$5\times \Big({4!\over 1!3!} +{4!\over 2!2!}+{4!\over 3!1!}\Big)= 70$$


*If $\color{red}{|{\rm range}(f)|=3}$
Then some we have to take from codomain 2 element, that we can do on ${5\choose 2}=10$ ways. Some elements take the same value so we have $$10\times \Big(2{3!\over 1!2!} +{3!\over 1!1!1!}\Big)= 120$$


*If $\color{red}{|{\rm range}(f)|=2}$
Then some we have to take from codomain 3 element, that we can do on ${5\choose 3}=10$ ways. Some elements take the same value so we have $$10\times 12= 120$$


*If $\color{red}{|{\rm range}(f)|=1}$
Then we have only constant functions and that is $5$
So we have in total $330$ such functions.
A: Solution if fuctions are surjective.
You probably mean nondecreasing functions. You can list all such functions:

*

*If $3$ consecutive elements take the same value then you have:

*

*$f(1)=f(2)=f(3)=1$ ...

*$f(1)=1$ and $f(2)=f(3)=f(4)=2$ ...

*$f(1)=1$ and $f(2)=2$ and $f(3)=f(4)=f(5)=3$ ...

*... 2 more possibilities.



*If two times $2$ consecutive elements take the same value.

*

*$f(1)=f(2)=1$ and $f(3)=f(4)=2$ ...


*$f(1)=f(2)=1$ and $f(3)=2$ and $f(4)=f(5)=3$ ...


*... 2 more possibilities.


*$f(1)=1$ and $f(2)=f(3)=2$ and $f(4)=f(5)=3$ ...


*$f(1)=1$ and $f(2)=f(3)=2$ and $f(4)=3$ and
$f(5)=f(6)=4$ and $f(7)=5$.


*... 1 more possibilities.


*$f(1)=1$ and $f(2)=2$ and $f(3)=f(4)=3$ and $f(5)=f(6)=4$ and $f(7)=5$.


*$f(1)=1$ and $f(2)=2$ and $f(3)=f(4)=3$ and $f(5)=4$ and $f(6)=f(7)=5$.


*$f(1)=1$ and $f(2)=2$ and $f(3)=3$ and $f(4)=f(5)=4$ and $f(6)=f(7)=5$.
This is it.
A: If the function is surjective.
Let $a$ denote the number of $x$ such that $f(x)=1$, similarly let $b$ denote the number of $x$ such that $f(x)= 2$..and so on till $f(x)= 5$.
Observe that the question is equivalent to no. of positive integer solutions of $a+ b+ c+ d+e = 7$ which is known.
