How can write the following function in LP:
$$ s= \begin{cases} 1 & 1 \leq x \leq C \\ 0 & \text{otherwise} \end{cases} $$ where $x$ takes only non-negative integers and $C$ is some large constant integer.
I've tried using big M, and came up with conditions for $s=1$. \begin{align} x-M \cdot (1-s) &\leq C\\ x+M \cdot (1-s) &\geq 1 \\ \end{align} But I wonder how to force $s=0$ when $x=0$ or $x\ge C+1$.