6. Unary Subtraction

The Dorpat printing house pulsed with the heavy rhythm of machines—presses thudding like ancient drums, rollers squealing faintly as they pulled wet sheets into the drying racks. Ink clung to the air, thick and metallic, and the floor was dusted in paper trimmings like the shavings of thought itself.

Karl, the journeyman printer, wiped his hands on a grimy apron and looked up as Mihkel stepped inside. „You’re the clever one, ja? Madli’s boy with the university brain.“

Mihkel offered a polite smile. „I suppose so.“

Karl gestured toward a stack of spoiled pages. „We printed two hundred. Seventeen misaligned. Now I need to know how many remain—quickly, not with counting on fingers like some child.“

Before Mihkel could reply, Johann, leaning idly against a crate of type, chuckled. „It’s like slicing bread from a loaf. You’ve got so many slices, and then… poof. Crumbs.“

Mihkel frowned, struck by the metaphor. Not because of its charm—but because it almost made sense. Bread, pages, mistakes. Loss. Subtraction. Not the counting of things, but the taking away.

For all the tales Johann loved, none of them could calculate how many pages still needed ink.

He found a quiet bench near the compositor’s table and reached into his coat for the folded length of tape he always carried. He marked it out carefully.

A subtraction problem. Loss embodied. He ran the tape through the Logic Mill with steady hand, watching each unary stroke fall away, one by one, as the machine simulated a kind of quiet forgetting—like memory worn down.

It was a strange feeling, seeing the machine remove rather than build. But it worked.

On the input tape, you'll get two positive numbers in the unary format separated by minus operator. Your task is to compute the difference of these two numbers. The first number is always greater than the second number. For example, if the input tape is |||||-||, your output should be ||| (5 - 2 = 3).

Logic Mill specs

Sign in to submit your solution.