Problem

Source:

Tags: function, combinatorics proposed, combinatorics



For any two positive integers $n$ and $p$, prove that there are exactly ${{(p+1)}^{n+1}}-{{p}^{n+1}}$ functions $f:\left\{ 1,2,...,n \right\}\to \left\{ -p,-p+1,-p+2,....,p-1,p \right\}$ such that $\left| f(i)-f(j) \right|\le p$ for all $i,j\in \left\{ 1,2,...,n \right\}$.