# context.divkbaseb(k, b)¶

Generates an automaton that recognises the writing in base $b$ of the numbers divisible by the integer $k$.

Preconditions:

• $2 \le b$
• the labelset has at least $b$ generators

Postconditions:

• the automaton has $k$ states
• Result = quotkbaseb(k, b).project(0)

## Examples¶

In [1]:
import vcsn
c = vcsn.context('lal_char(0-9), b')
c.divkbaseb(3, 2)
Out[1]:
In [2]:
c.divkbaseb(2, 4)
Out[2]:

If $k$ and $b$ are coprime, then the result is known to be minimal.

In [3]:
div4base4 = c.divkbaseb(4, 4)
div4base4
Out[3]:
In [4]:
div4base4.minimize()
Out[4]: