context.quotkbaseb(k, b)

Generate a transducer that accepts numbers in base $b$ that are divisible by $k$, and computes the quotient of their division by $k$ in base $b$.

Preconditions:

  • $2 \le b$
  • the labelset has two tapes
  • both labelsets have at least $b$ generators

Postconditions:

  • the automaton has $k$ states

See also:

Examples

In [1]:
import vcsn
c = vcsn.context('lat<lal_char(0-9), lal_char(0-9)>, b')
c.quotkbaseb(3, 2)
Out[1]:
%3 I0 0 0 I0->0 F0 0->F0 0->0 0|0 1 1 0->1 1|0 1->0 1|1 2 2 1->2 0|0 2->1 0|1 2->2 1|1

The transducer gives the quotient of the division by $k$.

In [2]:
a = c.quotkbaseb(7, 10)
a.shortest(10)
Out[2]:
$\varepsilon|\varepsilon \oplus \mathit{0}|\mathit{0} \oplus \mathit{7}|\mathit{1} \oplus \mathit{00}|\mathit{00} \oplus \mathit{07}|\mathit{01} \oplus \mathit{14}|\mathit{02} \oplus \mathit{21}|\mathit{03} \oplus \mathit{28}|\mathit{04} \oplus \mathit{35}|\mathit{05} \oplus \mathit{42}|\mathit{06}$