Can i find such a polynomial? Is there a practical interpretation of the following?
I would like a function $f$ s.t: for a set of distinct values $S=\{s_i\}_{i=0}^n$:
$$f(s_i,s_j)=1,  \forall j \in S,i\neq j$$ and 
$f(s_i,s_j) \neq 1, i\neq j $
Example:
$S={1,2,3}$ then i want such $f$ such that:
$f(1,2)=1$
$f(1,3)=1$
$f(2,1)=1$
$f(2,3)=1$
$f(3,1)=1$
$f(3,2)=1$
Put it in clear. Fixing the first input of $f$ from a value of the set then all the other possible values given as input to the $f$ should evaluate to 1. What i can find such $f$? Can i just say that it exists?
 A: The constant function $f(x,y)=1$ is a polynomial that seems to satisfy your needs.  I don't understand what you mean by the sentence "Fixing the first input..."
A: This can be done, but I don't know of any clean and simple way to do it.  You need to do a multivariate interpolation of the points $$(s_i,s_j,1) (i\neq j)$$ and $$(s_i,s_i,0)$$
These are $n^2$ conditions, so you should expect to get a polynomial with $n^2$ monomial terms, whose coefficients are determined by the process outlined in the above link.  This will be guaranteed to pass through the $n^2$ points, so $f(s_i,s_i)=0$ for each $i$, and $f(s_i,s_j)=1$ for each $i\neq j$.  However, there may be other zeroes of this polynomial, and other places where it assumes the value 1.
A: Ok, inyour example $1,2,3$ are relativly prime, $(1,2)=(1,3)=(2,3)=1$. 
For the first pair {$1,2$} we have that $(-1)\cdot 1+1\cdot 2=1$. For the second pair {$1,3$} we have $(-2)\cdot 1+1\cdot 3=1$. Then the polynomial $f(x)=(-1)\cdot (-2)x+1\cdot 1y$ over the ring $\Bbb Z_3[x,y]$ it's ok for the first two pairs. 
In general you can do this for all the pairs and take for $f(x)=ax+by$ over the ring $\Bbb Z_3[x,y]$ where $a$ is the product of all the past $a$'s like $(-1),(-2)$ and $b$ is the product of all the past $b$'s like $1,1$.
