Original problem: Create a DFA for every positive integer $k$, so that when DFA takes a binary string (reading from most significant bit), decides whether the number is divisible by $k$.
A DFA for a positive integer $k$ is basically a machine with $k$ states, each representing the current result mod $k$, that is, $\{0,1,2,3,\dots, k-1\}$. This is a almost full proof.
http://www.geeksforgeeks.org/dfa-based-division/
My problem: Is it possible to construct a DFA, for any positive integer $k$, such that when the DFA reads a binary number from the least significant bit, returns whether the number is divisible by $k$? I found some examples for $k=3, 4 \dots$ (One here http://www.idt.mdh.se/kurser/cd5560/02_03/senaste_nytt/ralfs_divby3.pdf), but have yet to find a general description for a machine for a general $k$.
It suffices to be able to check divisibility by $p^k$ for primes $p$, since you can always combine a finite number of DFAs into one that essentially runs them in parallel and accepts iff they all accept. This is trivial for $p=2$. If $p$ is an odd prime, $2$ is a unit in $\Bbb Z/p^k\Bbb Z$, so there is an $m\in\Bbb Z^+$ such that $2^m\equiv1\pmod{p^k}$, and hence such that $p^k\mid 2^m-1$.
Since your input is binary, you can easily work in base $b=2^m$. If $$n=\sum_{i=0}^rd_ib^i\;,$$ clearly $$n\equiv\sum_{i=0}^rd_i\pmod{p^k}\;,$$ and $$p^k\mid n\quad\text{ iff }\quad p^k\,\Big|\,\sum_{i=0}^rd_i\;.$$
In other words, you’re in a position to use an analogue of the familiar sum-of-the-digits test for divisibility by $3$ or $9$ in ordinary decimal notation.
Start with a ring of $p^k$ states $q_0,\ldots,q_{p^k-1}$ to keep track of the residue modulo $p^k$. Add states and transitions so that reading $m$ bits corresponding to a digit $d$ in base $2^m$ results in a net transition from state $q_i$ to state $q_{(i+d)\bmod 2^m}$. The initial state $q_0$ is of course the only acceptor state.