27. Unary Divisibility

Evening mist coiled low over Dorpat, blurring the yellow lanterns into trembling halos. Mihkel had just shut the door of his workshop when a hurried knock rattled it again.

Johann stood in the doorway—no swagger, no smirk, only a pale flush on his cheeks. His hair was damp with fog, his gloves mismatched, as if he had left in haste.

„I need your mind,“ he said without preamble.

Mihkel blinked. „Has Reichenstein thrown you out for insolence again?“

Johann shook his head, stepping inside and closing the door behind him. „No. This time it is… me.“ He hesitated, then placed a small bundle of wax candles on the workbench.

„I’m responsible for the lanterns at Friday’s gathering. There are 23 of us, and I bought these… 49 candles. I thought it generous. But if they cannot be divided evenly—if I miscount again—the others will laugh me out of the hall.“

He ran a hand through his hair, embarrassed. „You know how they look at me. All noise, no measure.”

Mihkel softened. The bravado Johann usually wore like a coat had slipped, revealing the anxious boy beneath.

„You want to know whether the number divides cleanly,“ Mihkel said. „Without leftovers.“

Johann nodded quickly. „Exactly. I could count, but… if I am wrong again—well. They remember every mistake I make.“

„Give me a little time,“ he said. „An hour or two. Let me work it out properly.“

Johann hesitated. „Are you sure? I can stay and help count—”

„No,“ Mihkel cut gently but firmly. „I need quiet for this. Come back later.“

Something in his tone convinced Johann. The flamboyance drained away, leaving only a tired nod.

„All right. I trust you. I’ll return after supper.“

When the door finally closed and Johann’s footsteps faded into the mist, Mihkel drew the shutters and crossed the room.

The Logic Mill waited under its cloth like a coiled secret. He uncovered it slowly, as if revealing a forbidden relic.

49 strokes on one side of the tape. 23 on the other. A clean unary division check. The gears whispered their mechanical logic, answering a question far heavier than candles.

On the input tape, you’ll get two numbers in the unary format separated by /. Your task is to check if the first number is divisible by the second number and output Y if it is, or N if it is not.

The first number is always greater than or equal to the second number. The numbers are between 1 and 100.

For example, if the input tape is ||||/||, your output tape should be Y (4 is divisible by 2). If the input tape is ||||/|||, your output tape should be N (4 is not divisible by 3).

Sign in to submit your solution.

Quest leaderboard
Discuss it on Reddit or Discord
This was the last quest for now.
Get updates about new quests by subscribing to the social media channels or RSS