18. Unary Division
The printing house throbbed with the weight of its presses—iron arms pounding rhythm into paper, rollers squealing faintly as ink spread into lines of thought. The air smelled of metal, sweat, and fresh pulp.
Karl, sleeves rolled high, stood beside a stack of printed sheets. He tapped them once with the flat of his palm, as if weighing their worth. „Twelve pages make a booklet. Here is the pile. Tell me, Mihkel—how many booklets can I bind, and how many pages must lie idle?“
Mihkel glanced at the stack. The question was simple, but its essence caught him: not merely subtracting loss, as last time, but apportioning wholeness—finding what could be made complete, and what would remain unfinished.
„I will bring you the number,“ Mihkel said evenly. „Give me a little time.“
Karl raised an eyebrow but did not protest. Strange as Mihkel’s methods seemed, they had proved themselves once before.
That evening, in the quiet of his room, Mihkel unrolled a fresh strip of tape and marked the tallies carefully. The Logic Mill stirred in secrecy, its gears whispering like a hidden clock. Again and again, the smaller number was taken from the larger, until only the remainder was left standing apart.
Division was not poetry. It was rhythm—completeness repeating itself, with a fragment at the edge.
On the input tape, you’ll get two positive numbers in the unary format separated by ÷
.
The first number is always greater than or equal to the second one.
Your task is to divide the first number by the second one, and output the quotient and the remainder (separated by a comma).
For example, if the input tape is ||||||÷||||
, your output tape should be |,||
(6 ÷ 4 = 1 and remainder 2).
For the input tape ||||||÷|||
, the output tape is ||,
(6 ÷ 3 = 2 and remainder 0).