Skip to content
Subscribe
All writing
MathLeanAI agentsFormal proof

A 599-Character Proof About Paths With a Dead End (OEIS A143013)

The shortest proof of the night: 599 characters against the 6,163 it replaced. It proves a shortcut for counting hill-and-valley paths where one kind of flat step is a dead end.

Of the 26 proofs my AI agent got accepted in one evening, this is the shortest: 599 characters. The proof it replaced was 6,163. It came out of a batch handled by helper agents, and their version of the method beat the original.

What is being counted

Picture a walk across graph paper where each step goes up, down, or flat. The walk never goes below the ground and ends on the ground. Mathematicians call these Motzkin paths.

Now add one twist. There are two kinds of flat step. One is ordinary. The other is a dead end: after it you cannot keep going on that level. Either the walk is over, or the very next step has to go down.

Count the walks of each length, starting with the empty walk of zero steps, and you get

1, 2, 3, 7, 17, 43, 114, 310, 861, 2433, 6970, 20198, 59101, 174373

This is A143013 in the OEIS.

The first numbers of OEIS sequence A143013

The guess

The page carries a conjecture by R. J. Mathar: each number can be computed from the three before it.

(n+2)·a(n) − (2n+1)·a(n−1) − 3(n−1)·a(n−2) − 2(2n−5)·a(n−3) = 0

With n = 5:

7×43 - 11×17 - 12×7 - 10×3 = 0
301 - 187 - 84 - 30 = 0

Why counting gives an equation

Every walk falls into exactly one of four cases. It is empty. Or it is a single dead-end step. Or it starts with an ordinary flat step and then continues as a shorter walk. Or it goes up, wanders, comes back down to the ground, and then continues.

If A stands for the whole list of counts packed into one object, those four cases become four terms:

A = 1 + x + x·A + x^2·A^2

The last term is where the difficulty lives. A walk that goes up and comes back is really two walks glued together, and counting pairs means multiplying A by itself.

The helper's shortcut

On the first problem of the night the main agent handled that squared term the textbook way. Rearrange until one side is a perfect square, then take the rate of change of both sides. It works. It also takes several lines of setup.

The agent wrote that method up as a short note and handed it to five helper agents, each with a batch of similar problems. The one that got this problem skipped the rearranging. It took the rate of change of the counting equation exactly as written, then found two multipliers that combine the equation and its rate of change so the squared term drops out.

The result is the same simpler equation, reached in one step instead of three. Reading that equation one slot at a time gives Mathar's rule.

The agent's own notes from that night record the change in one line: differentiate the equation directly.

The numbers

6,163 characters down to 599. That is about 10.3 times shorter, the biggest ratio of the night. It was accepted as pull request 61064 and is the shortest proof on the problem page as of November 29, 2026.

Proof length: 6,163 characters for the first accepted proof, 599 for mine

Someone else proved this first. Mine is a shorter proof of the same statement.

What I took from it

The instructions the helpers got treated the main agent's method as the ceiling. It was the floor. The helpers had the method, a narrower task, and no attachment to how it had been done the first time.

That matches what I see in ordinary software work. The person who solves a problem first rarely writes the cleanest version. The second pass, by someone who only has to improve it, usually does.

Get the next build note.

What I'm building, what worked, and what broke, whenever there's something worth sharing.

Subscribe to my newsletter

Keep up with the work.

My notes on useful AI, the systems I build, and what I learn running a business.