Skip to content
Subscribe
All writing
MathLeanAI agentsFormal proof

78557 Never Makes a Prime, and I Lost the Race by 24 Characters

Take 78557, multiply by any power of 2, add 1. You never get a prime. My AI agent proved it in 643 characters. Someone else got 619 merged while mine sat in the queue.

Take the number 78557. Multiply it by 2 as many times as you like, then add 1. You will never land on a prime number. Not at the tenth doubling, not at the millionth.

My AI agent proved that in 643 characters of Lean. It was never accepted. Somebody else's proof, 24 characters shorter, was merged while mine was still waiting in line.

The puzzle

Here are the first few results:

78557 × 1 + 1 = 78,558
78557 × 2 + 1 = 157,115
78557 × 4 + 1 = 314,229
78557 × 8 + 1 = 628,457

Each of those can be divided evenly by something small. 78,558 is divisible by 3. 157,115 ends in 5. 314,229 is divisible by 3 again. 628,457 is divisible by 73.

The claim is that this never stops. Every number of the form 78557 × 2^n + 1 has a small divisor, so none of them is prime. A number like 78557 is called a Sierpiński number, and this fact about it has been known since the 1960s. The list of these values is A258073 in the OEIS.

What is still open is whether 78557 is the smallest number with this property. That part is a famous unsolved problem and nobody on the site was asked to settle it. The task was the known half: get a computer to agree that every number in the list is composite.

Why it works

Seven small primes do all the work: 3, 5, 7, 13, 19, 37 and 73.

A 36-box grid showing which small prime divides 78557 times 2 to the n plus 1, for n from 0 to 35

Each box is one value of n, and the big number in it is a prime that divides the result. Look at the pattern in the top row and compare it with the rows under it. Every even n gives a multiple of 3. Every n that leaves remainder 1 when divided by 4 gives a multiple of 5. The gaps left over are filled by 7, 13, 19, 37 and 73.

The grid has 36 boxes because the pattern repeats every 36 steps. Doubling 36 times in a row multiplies a number by 2^36, and 2^36 - 1 happens to be divisible by all seven primes. So if a prime divides the result at step n, the same prime divides the result at step n + 36.

That turns an endless claim into a finite one. Check 36 cases. The repeat handles the rest.

How the proof was written

The Lean proof follows that outline exactly.

  1. State that for each of the 36 starting positions, one of the seven primes divides the result. Lean checks all 36 by direct computation.
  2. Show that adding 36 to n changes the value by a multiple of 2^36 - 1, which all seven primes divide. So the same prime keeps working.
  3. Finish with a short argument that a number with a divisor bigger than 1 and smaller than itself is not prime.

The agent's version came to 643 characters. The first accepted proof on the site was 1,327.

How I lost

The site replaces an accepted proof when a new one is at least 5 percent shorter and at least 20 characters shorter. Against 1,327, a proof of 643 wins comfortably.

But submissions wait in a queue, and that night the queue was more than ten thousand deep. While mine waited, another person's proof of 619 characters was merged. Now the bar was 619. To replace it I would have needed 588 or fewer. Mine was 643. The check ran, compared the two, and rejected it.

Proof length: 1,327 characters for the first accepted proof, 643 for mine, 619 for the one that was merged first

Twenty-four characters.

I had already told the agent it did not need to stop when a submission was rejected, only to tell me why. So it reported this one in a sentence and moved on to the next. I think that was the right call. Squeezing 55 more characters out of an already tight proof was a worse use of the evening than the twenty-odd problems still waiting.

What I took from it

Two things.

First, on a live board, being correct is the entry fee. Timing decides the rest. The same thing had already happened once that evening, when a two-hour delay on my side let someone else set a new record on the first problem.

Second, I like that the record of this loss is public. The problem page shows who holds the shortest proof, and my rejected submission is still there too. Nothing about this needs my word.

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.