I am working with a prime field $\operatorname{GF}(p)$ where the prime $p$ has the form $p=kn+1$ for some $n$ that is a power of $2$.
My question: is it possible to devise an algebraic function over such a field that would map a specific number to $1$ and all other numbers to $0$. For example, $f_{23}(x)$ would evaluate to $1$ for $x = 23$ and to $0$ for all other $x$.
Somewhat related: I can use the following function to map all odd numbers to $1$ and all even numbers to $0$:
$$ f_{odd}(x) = \frac{1 - r^x}{2} $$
where $r$ is the $2^{nd}$ root of unity.
By Fermat's little theorem $n^{p-1}\equiv1\pmod p$ whenever $p\nmid n$. This means that the polynomial $$ f_a(x)=1-(x-a)^{p-1} $$ takes the value $1$ at $x=a$, but $f(x)=0$ for all $x\in GF(p), x\neq a$.
A few remarks are in order