11. Decimal Increment
The spring fair in Dorpat burst like a thawed river into the market square—stalls draped in canvas, cabbages stacked like cannonballs, and the clang of blacksmiths echoing against the walls of the guildhall. Beneath a fluttering row of bunting, a dispute simmered.
„He owes taxes on fourteen crates, not thirteen!“ barked the town clerk, jabbing a finger toward a ledger. Peeter, a barrel-chested merchant with a moustache as proud as his price list, shook his head. „I wrote thirteen. That’s what I sold.“
Mihkel, passing by with a small sack of spring apples, paused as the clerk waved him over.
„You’re from the university, yes? Can you verify these figures? The ink’s smudged, but the line before says twelve. The pattern suggests a simple increment. But I need confirmation—precise.“
Mihkel examined the ledger. Ink-stained numerals marched down the page: ...11, 12, 13...
What the clerk wanted was simple. But what it required—mechanically—was not. Binary was clean, beautiful. Decimal was cluttered, full of edge cases and shifting columns.
Still, this was the real world. Grain didn’t count itself in ones and zeroes.
That night, in his cramped workroom, Mihkel stared at the input tape: 13
To increment a decimal number—to handle carries, overflow, tens becoming zeroes—was a far more tangled dance than anything the Mill had performed. Yet the principle was the same: recognize a digit, modify it, propagate changes if needed.
He adjusted the Mill’s gearing—not by adding new pieces, but by expanding its vocabulary. A new set of rules, to understand the difference between a 9 and an 8, between stillness and rollover.
It would be the most complex pattern he had attempted yet. But he felt no hesitation. Complexity, after all, was just clarity not yet expressed.
On the input tape, you’ll get a non-negative decimal number. Your task is to increment it by one.
For example, if the input tape is 13
, your output tape should be 14
.