AI Workflow · part 34
[Claude Code] Claude Picked an OEIS Sequence Stuck Since 2017 and Added Two Terms: 8×8 in 8.5 Hours
❯ cat --toc
- Asking Claude to find an open problem on OEIS
- What A285765 asks: how many queen placements connect
- Why brute force can't reach 8×8
- How three ideas cut 2,700 years to 8.5 hours
- Idea one: count the placements that don't connect
- Idea two: follow only the first group
- Idea three: stop when the green runs out
- The whole method on a 3×3 board, in ten steps
- Results: a(7) in 7 seconds, a(8) in 8.5 hours
- How to check an answer with nothing to compare against
- Submitting AI-assisted results to OEIS
- How to try this yourself in five steps
- Deep dive: the formula, reproduction commands and raw output
- The counting formula
- One more pruning rule
- First groups visited versus disconnected placements
- Reproducing the runs
- Raw output
- Checkpoints and resume
- The run-time estimate that went wrong
TL;DR
Claude Opus 5.5, running in Claude Code, picked an OEIS sequence nobody had extended since 2017 and computed two new terms. A285765 counts the ways to place queens on an n×n board so that they all connect. On one 24-core CPU, a(7) = 562,919,128,262,041 took about 7 seconds and a(8) = 18,446,595,092,102,706,804 took 8.5 hours, where checking all 2^64 placements one by one would take about 2,700 years. The method: count the placements that don't connect instead, enumerate only the first group of queens, and add up everything after it with 2^k − 1. Both terms are now in OEIS.

A 9½-minute animated explainer with Mandarin narration. The visuals are mostly boards and numbers.
Asking Claude to find an open problem on OEIS
I could be using Claude to discover something new. Instead I kept having it make weird images and weird characters. So I asked it: what could you do that I'd find interesting but would never think to ask for?
One answer: find a math problem whose answer isn't published yet, and compute it.
The place to look is OEIS, the On-Line Encyclopedia of Integer Sequences, a database of number sequences and the terms found so far. Entries tagged with the keyword more need more terms. You can search for them directly:
https://oeis.org/search?q=keyword:more&fmt=json
Claude skipped the famous ones, like Dedekind numbers (A000372) and Wieferich primes (A001220), and looked for entries that were obscure, short and untouched for years. It came back with five: A285765, A287071, A165143, A030446 and A400997, the last one added on 2026-11-14.
It chose A285765, connected subgraphs of the queens graph. It had 6 known terms, 1, 15, 495, 64815, 33478163, 68694593248, and nobody had extended it since 2017. Its siblings went much further: the king version, A286139, is listed to 16 terms, and the rook version, A286189, to 50. The program attached to the entry checks every subset one at a time.
Before it started, I stopped it: had anyone done this already, and what would we get out of it? The entry was last revised on 2025-02-16 and still had 6 terms, and I found no a(7) anywhere else. The payoff is one line in OEIS, with no money and no theorem attached. What I wanted was the process.
What A285765 asks: how many queen placements connect
A chess queen moves along rows, columns and diagonals, in eight directions, as far as it likes.
Pick some cells on an n×n board and put a queen on each. Two queens reach each other if they share a row, a column or a diagonal. A queen sitting between two others doesn't block them here.
A placement is connected when the queens form one piece: you can get from any queen to any other by hopping between queens that reach each other. One queen alone counts, and so does a full board. Anything that splits into separate pieces is disconnected.
The question is how many connected placements an n×n board has. Formally, it's the number of connected induced subgraphs of the n×n queen graph.

Start with 2×2. Each of the four cells has a queen or doesn't, so there are 2^4 = 16 placements. Drop the empty board and 15 are left. On a 2×2 board every cell reaches every other cell, so all 15 are connected. a(2) = 15.
On 3×3 there are 2^9 = 512 placements, or 511 without the empty one. Only 16 of them are disconnected: 8 with two queens and 8 with three. 511 − 16 = 495.

4×4 has 65,535 placements, 720 of them disconnected, so the answer is 64,815. 5×5 gives 33,478,163 and 6×6 gives 68,694,593,248.
Why brute force can't reach 8×8
The obvious method is to check every placement. An 8×8 board has 64 cells, so there are 2^64 = 18,446,744,073,709,551,616 placements.
Checking all 2^36 placements of 6×6 took 317.9 seconds on 24 threads. Scale that rate up and 7×7, with 2^49 or about 5.6×10^14 placements, takes about 30 days. 8×8 takes about 2,700 years. Both are constant-rate estimates, not actual runs.
How three ideas cut 2,700 years to 8.5 hours
Idea one: count the placements that don't connect
Queens reach far, so almost every placement connects. The known terms showed it. On 6×6, only 2^36 − 1 − a(6) = 24,883,487 placements fail to connect (the −1 is the empty board). On 5×5 it's 2^25 − 1 − a(5) = 76,268. On 8×8 the count turned out to be 148,981,606,844,811, about 1 in every 123,819 placements.
So the program counts the disconnected placements and subtracts them from 2^(n²) − 1. That still means finding 149 trillion placements, each one exactly once.
Idea two: follow only the first group
Take three queens on a 3×3 board: top-left, middle-right and bottom-middle. The top-left queen reaches neither of the other two, so this placement is disconnected. It has two groups: the top-left queen alone, and the other two, which share a diagonal.

Every disconnected placement splits into groups like that. Read the board like a page: the top row left to right, then the next row down. The first queen you meet belongs to one group, the first group. Every disconnected placement has exactly one first group, so sorting by it never counts anything twice.
Once the first group is fixed, two kinds of cells are off limits: cells it reaches, because a queen there would join it, and cells before the first queen, because a queen there would become the first queen. The cells left over can still take queens. The figures and the video color them green.

In the 3×3 example, with top-left as the first group, only middle-right and bottom-middle stay green. Any non-empty set of green cells gives a disconnected placement with that first group. Two green cells give 2^2 − 1 = 3 placements: one cell, the other, or both. With k green cells that's 2^k − 1 placements, and none of them has to be listed. With 18 green cells, 2^18 − 1 = 262,143 placements go into the total in one step.
Idea three: stop when the green runs out
As the first group grows, the green shrinks. Once it's gone, no second group can fit, however many queens join the first, so the program drops that whole branch. Queens cover so much ground that the green runs out after only a few of them.
The whole method on a 3×3 board, in ten steps
Cells are named by position: top-left, top-middle, top-right, middle-left, center, middle-right, bottom-left, bottom-middle, bottom-right. Ten first groups have green cells left:
- Top-left alone. Green: middle-right and bottom-middle, so 2^2 − 1 = 3. Running total 3.
- Top-left and top-right. Green: bottom-middle, so 1. Total 4.
- Top-left and bottom-left. Green: middle-right, so 1. Total 5.
- Top-middle alone. Green: bottom-left and bottom-right, so 3. Total 8.
- Top-middle and middle-left. Green: bottom-right, so 1. Total 9.
- Top-middle and middle-right. Green: bottom-left, so 1. Total 10.
- Top-right alone. Green: middle-left and bottom-middle, so 3. Total 13.
- Top-right and bottom-right. Green: middle-left, so 1. Total 14.
- Middle-left alone. It can't reach top-right, but top-right comes before it, so that cell is out too. Green: bottom-right only, so 1. Total 15.
- Middle-right alone. Green: bottom-left only, so 1. Total 16.
The center reaches every cell, and a queen in the bottom row reaches every cell after it, so neither leaves any green. The ten steps add 3, 1, 1, 3, 1, 1, 3, 1, 1, 1 = 16, and 511 − 16 = 495, the known answer.

Results: a(7) in 7 seconds, a(8) in 8.5 hours
Everything ran on one AMD EPYC 7402 (24 cores), with 24 threads and no GPU. The program is C with OpenMP. Each set of cells is a single 64-bit integer, one bit per cell, so an 8×8 board uses all 64 bits.
The second column is the real work: how many first groups the program visited.
| Board | First groups walked | Time | Answer |
|---|---|---|---|
| 3×3 | 10 | — | 495 |
| 4×4 | 340 | — | 64,815 |
| 5×5 | 43,296 | — | 33,478,163 |
| 6×6 | 16,964,861 | 0.01–0.02 s | 68,694,593,248 |
| 7×7 | 22,675,282,126 | 6.79 s | 562,919,128,262,041 (new) |
| 8×8 | 112,872,055,914,761 | 30,460 s (8.5 h) | 18,446,595,092,102,706,804 (new) |
On 8×8 it visited about 3.7 billion first groups per second. 148,981,606,844,811 placements are disconnected, so a(8) = 2^64 − 1 − 148,981,606,844,811. On 7×7 the disconnected count is 30,825,159,270.
How to check an answer with nothing to compare against
These numbers weren't published anywhere, so there was nothing to compare against. Claude checked them four ways.
- Brute force on small boards. Up to 6×6, checking every placement agrees with the new method on all six terms.
- A second program that searches in a different order. It renumbers the cells at random, follows the group of the last queen instead of the first, branches in a different order and uses an explicit stack. Its partial sums look nothing like the first program's, and the totals match to the last digit. 7×7 also matched with a second random numbering and a different split of the work. On 8×8 the second program took 74,617 seconds, 20.7 hours.
- Known sequences as regression tests. Switched to the rook graph (rows and columns only), the same code reproduces A286189: 1, 13, 397, 55933, 31450861, 67253507293. Switched to the king graph (one step in any direction), it reproduces A286139: 1, 15, 388, 37196, 14765089.
- A rough sanity check. Nearly every disconnected placement has one queen sitting isolated. An estimate from that case alone lands about 0.18% off the real count on 8×8, 0.7% on 7×7 and 2.0% on 6×6.
The weak spot: both programs rest on the same idea, so if it has a hole, both are wrong the same way. The idea itself is only fully checked up to 6×6. 7×7 never got a brute-force run (about 30 days by my estimate), and there's no third, mathematically different method.
Submitting AI-assisted results to OEIS
Work started on 2026-11-25, and a(7) came out that day. The first 8×8 program finished on the 25th and the second on the 26th. On 2026-11-26 I submitted a(7) and a(8) to OEIS under my name, and after editor review they went live the same day:
The code and run logs are public:
https://github.com/coolthor/queen-graph-connected-subgraphs
Claude picked the problem, came up with the method, wrote the programs and designed the checks. I made it check whether anyone had done this first, learned the method well enough to explain it myself, and submitted it under my name, so I'm responsible for it.
I read the OEIS rules on AI before submitting. The gist: you have to understand the work and take responsibility for it; replies to editors must be written by you, not pasted from an AI; an AI is never listed as an author; and mass submissions need permission first.
How to try this yourself in five steps
- Search OEIS for
keyword:more. Pick something obscure, short and untouched for years; skip the famous ones. - Before any code, check when the entry was last revised, whether someone has published new terms elsewhere, and what you'd get out of it.
- Have the AI reproduce the known terms with the dumbest possible method before it proposes a clever one.
- Implement the new method twice with different traversal orders, compare the totals, and write down which assumptions the two programs share.
- Read the platform's AI policy in full before submitting, and make sure you can explain the method yourself.
Deep dive: the formula, reproduction commands and raw output
You can skip this section; nothing above depends on it. It has what you need to rerun the numbers, or to hand this page to a model and ask it questions.
The counting formula
D = Σ_C (2^|F(C)| − 1)
a(n) = 2^(n²) − 1 − D
D is the number of disconnected placements. C runs over every first group whose green set is not empty. F(C) is the green set: the cells numbered after the smallest cell in C that are neither in C nor reached by C. |F(C)| is the number of cells in it.
One more pruning rule
If a cell reaches every cell in F, adding it to the first group is certain to leave no green cells, so that branch is ruled out before it starts. On 7×7 this made the run 18% faster, with the same result.
First groups visited versus disconnected placements
The number of first groups walked comes to about 0.74–0.76 times D: 0.736 on 7×7 and 0.758 on 8×8.
Reproducing the runs
You need gcc and OpenMP.
make
OMP_NUM_THREADS=24 ./anchor 7
OMP_NUM_THREADS=24 ./maxbin 7 2024
OMP_NUM_THREADS=24 ./brute 6
anchor is the main program, maxbin is the second program (its second argument, 2024 here, is the seed for the random cell numbering), and brute checks every placement.
Raw output
The main program's lines for 7×7 and 8×8:
method=A n=7 disconnected=30825159270 a=562919128262041 nodes=22675282126 seconds=6.79
method=A graph=queen n=8 disconnected=148981606844811 a=18446595092102706804 nodes=112872055914761 seconds=30459.83 threads=24
nodes is the number of first groups visited.
Checkpoints and resume
The 8×8 runs can stop and resume from a checkpoint file. The second program's checkpoint holds partial sums for 2,931,426 tasks. Adding them up again from the file gives 148,981,606,844,811.
The run-time estimate that went wrong
The first time estimate sampled one task in every 2,000, and a few very large tasks threw it off. The programs now keep a live count of progress instead.
FAQ
- What does OEIS A285765 count?
- It counts the ways to place queens on an n×n board so that every queen connects to every other through queens that share a row, column or diagonal. A single queen counts, and so does a full board. The formal name is the number of connected induced subgraphs of the n×n queen graph, and the entry had been stuck at 6×6 since 2017.
- How was a(8) computed in 8.5 hours when brute force would take about 2,700 years?
- The program counts the placements that don't connect and subtracts them from 2^64 − 1. It sorts each disconnected placement by its first group, the group holding the first queen in reading order, and adds the free choices left over with 2^k − 1 instead of listing them. Branches where no free cells remain are skipped, so it only visited about 113 trillion first groups, at about 3.7 billion per second on 24 CPU threads.
- How do you verify a number with no published value to check against?
- Here the new method matched brute force on every board up to 6×6, a second program that searches in a different order got the same totals on 7×7 and 8×8, and the same code reproduced the known rook and king sequences A286189 and A286139. The weak spot is that both programs share one idea, and that idea is only fully checked up to 6×6.
- Does OEIS accept AI-assisted submissions?
- Yes, with conditions. I submitted the two terms under my own name after reading the OEIS rules on AI. In short: the submitter has to understand the content and take responsibility for it, replies to editors must be your own writing, AI is not listed as an author, and mass submissions need permission first. The two new terms were reviewed and went live on 2026-11-26.
Read next
- 2026-10-22[Claude Code] My AI agents are a pixel-art JRPG party now. Codex took 212 tickets in a week
A Claude Code mod that draws your AI agents as a pixel-art JRPG party with work animations and stat sheets. It showed me Codex took 212 tickets in 7 days.
- 2026-10-04[Claude Code] Build a Resource Dashboard Inside Claude Code With Six Prompts
Claude Code mods let a plugin draw a live pane in your session. Six prompts, each run in a fresh session, build a GPU, disk, quota and local-model dashboard.
- 2026-08-31[Dev Workflow] AI Slop Is Structural: 93.2% Detectable With Every Style Tell Stripped
A COLM 2026 paper strips every style signal from 61,608 stories and still tells human from AI at 93.2% macro-F1. The tell is structure, not em-dashes.
- 2026-08-21[AI Agent] From 41 Minutes to 73 Seconds: Why My Coding Agent's Small Tickets Were So Slow
Dissecting 41 Codex sessions turned up a wall-clock formula (tool calls x 14.3s) and cut a stuck ticket from 41 minutes down to 73 seconds.
Don't miss the next one
Subscribe, and you won't.
One-click unsubscribe anytime.