Let's say you have a set of binary numbers (or strings, whatever) $n$ each of odd length. How does one derive the algebraic (or arithmetic) form function $f(n) = b$ where $b \in \{0,1\}$ and is equivalent to the center digit of $n$, which by definition of odd numbers, must exist.
I feel like this is incredibly easy but I don't know the vocabulary to search for a solution online. Note: I am looking for a general formula, not a programming solution.
$$ f_n(a) = \left\lfloor \frac{a}{2^{\frac{n-1}{2}}} \right\rfloor \mod 2 $$