2. Unary Even Odd

The road to the village lay softened by rain, the ruts in the soil glistening under a pale northern sky. Mihkel’s boots sank just enough to remind him he was no longer in Dorpat—not in mind, nor in terrain. He had been invited here by Madli, the village schoolteacher, a woman with the bearing of one who wrestles with truth not in lecture halls, but in muddy yards and cold morning hearths.

Madli met him near the schoolhouse, a stout building half-timbered and gray, like all things that endure too many winters. Her face was drawn with fatigue, but her eyes were lively—a rare pairing Mihkel had learned to trust.

„They speak in riddles again“, she said, pushing open the door. Inside, children sat cross-legged on worn sheepskin mats near the stove, their slates set aside for the moment. A girl with a thick blond braid was reciting something in singsong:

„The witch’s goats walk in pairs… or don’t.
They bleat and clatter—count if you want.
But tread with care, for if they’re odd,
She stirs the pot and gives a nod.“

Laughter, muffled giggles. A boy thumped his heel against the stove rhythmically, as though marking time in a hidden meter.

Madli knelt beside Mihkel and whispered, „They’ve invented this game. Count the lines they draw, and guess if the witch is pleased—that is, if the number is even or odd. They don’t know what parity is. But they feel it.“

And suddenly, Mihkel saw the shape of it—the echo of logic in rhyme. He felt a gentle warmth behind the breastbone. This wasn’t just childish fancy. This was the seed of an abstraction. And here, in the village, among goats and riddles, was a chance to name it.

That night, in the borrowed attic room above Madli’s home, he lit the oil lamp and reached for the Logic Mill.

Pairs… or don’t.
Even… or odd.
It was a question. The Mill would answer.

On the input tape, you'll get a positive number in the unary format. Your task is to check if the number is even or odd. For example, if the input tape is |||||||, your output should be O (letter, not zero number) because 7 is odd. If the input tape is ||||||, your output should be E because 6 is even.

Logic Mill specs

Sign in to submit your solution.