{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# `context`.`quotkbaseb`(_`k`_, _`b`_)\n",
"\n",
"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$.\n",
"\n",
"Preconditions:\n",
"- $2 \\le b$\n",
"- the labelset has two tapes\n",
"- both labelsets have at least $b$ generators\n",
"\n",
"Postconditions:\n",
"- the automaton has $k$ states\n",
"\n",
"See also:\n",
"- [context.divkbaseb](context.divkbaseb.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Examples"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"mutable_automaton, letterset>, b>>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import vcsn\n",
"c = vcsn.context('lat, b')\n",
"c.quotkbaseb(3, 2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The transducer gives the quotient of the division by $k$."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/latex": [
"$\\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}$"
],
"text/plain": [
"\\e|\\e + 0|0 + 7|1 + 00|00 + 07|01 + 14|02 + 21|03 + 28|04 + 35|05 + 42|06"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = c.quotkbaseb(7, 10)\n",
"a.shortest(10)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}