66

In the kitchen of our previous apartment hung a clock on which the numbers from 1 to 12 were written as arithmetic expressions, slightly more complicated than the plain number, but still easily solvable in the mind.

At some point in time, I began to wonder, if it were possible to create such a layout for a clock programmatically. You would basically need a function that could map the numbers from 1 to 12 to a more complicated expression that would meet the constraint of being suitable for the layout (space limitation) and probably also the requirement of being easy enough to be solveable in your mind.

On a high-level programming this would require two steps: one for making a number more complicated in a randomized manner, and one for checking the result against some constraints.

I remember from a university lecture on programming paradigms, that it was reasonably easy to use Prolog to calculate the derivative of a polynomial function by symbolic transformations. But maybe it would be easier to map the numbers to some kind of abstract syntax tree for arithmetic expressions and manipulate that with equivalent operations.

However, once that is in place, you'd still need to encode the constraints, because the charme of that particular clock was that all the representations were both legible and easily solvable in your head. A measure for the latter might be the hardest thing to encode programmatically.

I think it might make for a fun recreational programming project, as it has many good properties: a well defined scope, enough room to experiment, overall low stakes, and the end result would look cool.