Altamens Pesquisa · Reproducible calculation · methods note
How Often Does a Random Nonogram Have Only One Answer?
Fill a small grid at random and its clues usually point to one picture, but not always. An exact count of every 3×3, 4×4 and 5×5 grid, and what it means for a puzzle generator.
Resumo
A nonogram gives the lengths of the filled runs in every row and column, and the solver rebuilds the picture. Some clue sets fit more than one picture. We enumerated every 3×3, 4×4 and 5×5 grid, reproduced the published counts of grids whose clues have a single solution (384, 52,362 and 25,309,575), and found that the share is 75% to 80% at these sizes when every grid is equally likely.
The share depends on how full the grid is. Among 5×5 grids with 5 or 6 filled squares, only about 28% are unique; with 16 or more, over 95% are. For the random generator of the Altamens Pixel Logic puzzle, which fills each square with probability 0.55 and keeps a grid only if its solution is unique, 85.3% of 4×4 attempts and 83.2% of 5×5 attempts are kept, so a board needs about 1.2 attempts on average. Of the boards it keeps, 98.5% (4×4) and about 99.2% (5×5) can be solved one line at a time. These are properties of grids and of a generator; no data on people solving puzzles was used.
Principais conclusões
- Random small grids usually have a unique answer, but not always: about 1 in 4 to 1 in 5 equally likely 3×3 to 5×5 grids share their clues with another grid. A generator that does not check uniqueness will sometimes mark a correct-looking answer wrong.
- Fuller grids are much more often unique. 5×5 grids with 5 or 6 of 25 squares filled are unique about 28% of the time, those with 16 or more over 95% of the time, so a fill rate a little above one half makes a uniqueness filter cheap.
- Unique is not the same as easy. Under the Pixel Logic generator about 1 board in 66 at 4×4 and 1 in 127 at 5×5 has one answer but cannot be finished with single-line logic, so about 1 full 12-round game in 9 contains such a board.
1The short answer: usually one, sometimes two or more
If you fill the squares of a small grid at random and write down its row and column clues, those clues pin down the original picture most of the time. Across all equally likely grids, the share with a single solution is 75.0% at 3×3, 79.9% at 4×4 and 75.4% at 5×5. The rest share their clues with at least one other grid, so a solver could reach a valid answer that is not the picture the puzzle maker had in mind.
The smallest example needs only two filled squares. In a 4×4 grid with one filled square in each of the first two rows and the first two columns, the clues are 1, 1, 0, 0 for rows and 1, 1, 0, 0 for columns. The squares can sit on either diagonal of the top-left 2×2 corner, and both pictures fit every clue. The online encyclopedia of integer sequences (OEIS) uses this same 2×2 pattern to explain why 2 of the 16 grids of size 2×2 are not unique.1
2Method: count every grid, then check against published counts
We enumerated every grid of size 3×3 (512 grids), 4×4 (65,536) and 5×5 (33,554,432), computed its clues and counted how many grids share each clue set. A grid is unique when no other grid of the same size has the same clues. To model a generator that fills each square with probability p, each grid with k filled squares out of n² is weighted by pᵏ(1 − p)ⁿ²⁻ᵏ, using exact fractions.
We also tested which unique grids can be solved one line at a time: take a row or column, list every filling that fits its clue and the squares already decided, fix the squares on which all of them agree, and repeat until nothing changes. This is the rule used by OEIS sequence A391619, which counts grids solvable by "analyzing each row and column in isolation, without guessing and backtracking". It is computed exactly for 3×3 and 4×4, and estimated for 5×5 from 200,000 accepted grids per fill rate with a fixed random seed.2
The script stops with an error unless its counts equal the published ones: 384, 52,362 and 25,309,575 unique grids (OEIS A242876, independently recounted by Felgenhauer) and 384 and 51,234 line-solvable grids at 3×3 and 4×4 (A391619). All match. The 5×5 estimate for equally likely grids, 98.69% line-solvable (95% interval 98.64% to 98.73%), contains the share implied by the published 5×5 counts, 24,976,511 of 25,309,575, or 98.68%.1,2,3,4
Finally, a separate script runs the site's own TypeScript functions with a seeded random generator. It kept 85.46% of 20,000 random 4×4 attempts and 83.17% of 20,000 5×5 attempts, close to the exact 85.26% and 83.25%.
3How often a grid is unique, by size
6×6: 49,745,060,669 unique and 48,625,108,931 line-solvable grids out of 68,719,476,736, as published in OEIS.
Every grid counted once (equivalent to a fill rate of 50%). Sizes 3 to 5 computed here; sizes 1, 2 and 6 from the published OEIS counts A242876 and A391619.
The share is not a smooth curve at these small sizes, but the published counts point down as grids grow: 72.4% of all 6×6 grids are unique. OEIS notes that an earlier 6×6 count in Batenburg and Kosters' study of nonogram difficulty was slightly wrong; the current value agrees with Felgenhauer's independent recount.1,3,4
4Fuller grids are far more often unique
Every filled-square count from 0 to 25, and the 4×4 table, are in by_fill.csv.
Exact counts from by_fill.csv. Grids with 0 or 1 filled squares, or with all or all but one filled, are always unique and are left out of the chart.
Sparse grids are the problem. A 5×5 grid with 5 or 6 filled squares is unique only about 28% of the time, because isolated single squares can often swap places in pairs of rows and columns without changing any clue, as in the diagonal example above. Half-full grids (12 or 13 squares) are unique 75.5% and 83.6% of the time, and grids with 16 or more filled squares over 95% of the time. The 4×4 pattern is the same: 40% to 59% of grids with 2 to 6 filled squares are unique, against over 90% with 9 or more.
Foote and Krizanc report a related result for solving rather than counting: in their experiments, how hard it is to deduce any square without guessing is largely determined by the density of filled cells. Their measure is different from ours, so the two results support each other only in direction.5
5What this means for the Pixel Logic generator
We inspected makePixels in app/lib/puzzleCollection.ts (commit d8a87fd). Rounds 1 to 4 use a 4×4 grid and rounds 5 to 12 a 5×5 grid. Each square is filled with probability 0.55. A grid is kept only if it has at least one filled and one empty square and an exhaustive search finds exactly one solution for its clues; otherwise the generator draws again, up to 60 times, before falling back to a fixed striped grid.
4×4: attempt accepted
5×5: attempt accepted
4×4: accepted board line-solvable
5×5: accepted board line-solvable
Values from results.csv.
Exact for acceptance and for 4×4 line solvability; 5×5 line solvability is a seeded estimate from 200,000 accepted grids (95% interval about ±0.05 points).
- Filling a little more than half the squares raises the share of attempts kept from 79.9% to 85.3% at 4×4 and from 75.4% to 83.2% at 5×5. A board needs 1.17 attempts on average at 4×4 and 1.20 at 5×5.
- The fallback almost never happens. The chance that 60 attempts in a row fail is about 10⁻⁵⁰ at 4×4 and 3 × 10⁻⁴⁷ at 5×5, and the site's own code produced no fallback board in 5,000 seeded calls.
- Kept boards are slightly fuller than the fill rate: 56.8% (4×4) and 56.7% (5×5) of squares on average, because sparse grids are rejected more often.
6Unique is not the same as solvable line by line
A unique answer guarantees that logic can reach it in principle, not that the usual one-line-at-a-time technique will. The first case our script finds is a 4×4 grid with row clues 1 1, 2, 0, 0 and column clues 1, 1, 1, 1. The two empty rows are immediate, but then no single row or column forces any square. You have to reason about the top two rows together: the run of 2 in row 2 must sit in the middle, because anywhere else row 1 would need two adjacent squares and its clue 1 1 forbids that.
Under the Pixel Logic generator, 1.51% of kept 4×4 boards and about 0.79% of kept 5×5 boards are like this: roughly 1 in 66 and 1 in 127. A full game has 4 boards of 4×4 and 8 of 5×5, so about 11.7% of full games, a little more than 1 in 9, include at least one such board. Pixelogic, a separate nonogram app, reports that it uses the stricter line-solvable standard when choosing puzzles for people.6
7For solvers and puzzle makers
- If you satisfy every clue and a puzzle still says you are wrong, the puzzle may have more than one solution. Look for a 2×2 block of squares that can swap diagonally without changing any clue.
- If a pass through every row and column changes nothing, the puzzle may need two lines at once. Pick an undecided square, follow what happens if it is filled, and keep the result only if it does not break a clue.
- If you generate puzzles at random, always run a uniqueness check, and expect it to reject about 1 attempt in 5 or 6 at 4×4 and 5×5. Filling slightly more than half the squares makes rejections rarer.
- If you want every puzzle to be solvable line by line, check that separately: uniqueness alone lets through about 1% to 2% of boards at these sizes that need wider reasoning.
The techniques behind line solving are explained step by step in How to Solve Nonograms, and you can try a generated board in Pixel Logic or browse the other puzzles in the logic puzzles collection. Solving more nonograms makes you better at nonograms; the science page explains why that is not evidence of a wider change in thinking.
8Limitations
- Grid sizes 3×3 to 5×5 were computed; the 6×6 figures are published counts that we did not recompute. Shares at other sizes and fill rates will differ.
- The 5×5 line-solvable share under the Pixel Logic fill rate is a Monte Carlo estimate with a 95% interval of 99.17% to 99.25%. All other figures are exact.
- "Line-solvable" is one specific deduction rule. A puzzle outside it can still be solved by logic, and none of these figures measures human difficulty.
- The generator figures describe the code at commit d8a87fd. A change to the fill rate, the grid sizes or the uniqueness check would change them.
- This is a calculation, not a study of people or of Altamens players: no participant, account, analytics or game data was used.
- AI-assisted, with automated checks only. No independent human methods review and no journal peer review.
9Data and reproducibility
Download the results by grid size and fill rate (CSV), the uniqueness by filled squares (CSV), the enumeration script (Python 3 and NumPy, about 90 seconds), the generator cross-check and the methods and claim sheet, which lists the expected file hashes. The files contain no participant or customer data.
Referências
- 1.Greathouse CR IV, Greathouse S A242876: Number of n X n nonograms (hanjie) which can be solved uniquely. The On-Line Encyclopedia of Integer Sequences, 2014. Data checked 2026-11-18. OEIS content is licensed CC BY-SA 4.0.. https://oeis.org/A242876
- 2.Zabolotskii A A391619: Number of n X n nonograms (hanjie) which can be solved uniquely by iteratively analyzing each row and column in isolation. The On-Line Encyclopedia of Integer Sequences, 2026. Data checked 2026-11-18.. https://oeis.org/A391619
- 3.Felgenhauer B Counting Nonograms. int-e.eu (author's page, with source code), 2025. Independent counts of uniquely solvable rectangular nonograms. Checked 2026-11-18.. https://int-e.eu/nono/
- 4.Batenburg KJ, Kosters WA On the difficulty of Nonograms. ICGA Journal 35(4), 195-205, 2012. Cited for its counts and difficulty framework as described in OEIS A242876 and A391619; full text not reviewed for this note.. https://doi.org/10.3233/ICG-2012-35402
- 5.Foote A, Krizanc D Nonogram: Complexity of Inference and Phase Transition Behavior. arXiv:2507.07283, 2025. Preprint, not peer reviewed. Summary based on the abstract.. https://arxiv.org/abs/2507.07283
- 6.Riley J (okayest! studios) Pixelogic Weekly #14. Pixelogic Weekly newsletter, 2025. Reports 25,309,575 unique and 24,976,511 line-solvable 5×5 puzzles and that Pixelogic uses the line-solvable standard. Checked 2026-11-18.. https://weekly.pixelogic.app/p/pixelogic-weekly-14