Skyscrapers Puzzle & Clue Maths

Play the visibility logic puzzle, and see why its clue numbers are Stirling numbers and why most grids cannot be made into a puzzle at all.

Every row and column holds each height once. The edge numbers say how many buildings you can see from there — a taller one hides everything shorter behind it.

The clue numbers are Stirling numbers

How many arrangements of n buildings show exactly k? Not some puzzle-specific formula — the unsigned Stirling numbers of the first kind, the same sequence that counts permutations by their number of cycles. Checked against the Stirling recurrence over every ordering up to n=8: 36 cells, zero mismatches.

Buildingssee 1see 2see 3see 4see 5see 6see 7see 8
3 2 3 1
4 6 11 6 1
5 24 50 35 10 1
6 120 274 225 85 15 1
7 720 1,764 1,624 735 175 21 1
8 5,040 13,068 13,132 6,769 1,960 322 28 1

The two ends have closed forms of their own. Exactly one arrangement shows all n — strictly increasing, the only clue that settles a line by itself. And (n−1)! show just one, because the tallest has to be in front and the rest can be in any order at all.

A clue of 1 feels like the ordinary case. It is not: a clue of 2 is commoner at every size from 3 to 7 — and at n=8 the mode moves again, to 3. Worth knowing before generalising from a 5×5 puzzle, because that pattern is already wrong by 8×8.

Two clues on one line can never add to more than n+1

The left and right clues on a row are not independent. The tallest building is visible from whichever side it faces and blocks the other, so the two counts can never total more than n+1. Here is the whole grid for a 5-wide row — every blank cell is a clue pair that cannot happen:

left \ right12345
1 6 11 6 1
2 6 22 18 4
3 11 18 6
4 6 4
5 1

Look at the bold anti-diagonal, the pairs that hit the maximum: 1, 4, 6, 4, 1. That is Pascal’s triangle. So both of the famous triangles of combinatorics turn up in a puzzle about not being able to see past a tall building — Stirling down the rows, binomial along the edge. A 1 on both ends of the same line is impossible on any board wider than one.

And most grids cannot be made into a puzzle at all

The obvious way to build one of these is to take a filled grid, read off all 4n clues, and start removing them while the answer stays unique. It does not work, because most grids are not determined by their own clues even with every one of them showing.

Exhaustively, over all 576 Latin squares of order 4: 204 of them — 35.4% — have a twin that produces identical numbers on all four sides. And it gets worse quickly: around 96% of 5×5 and 6×6 grids are ambiguous.

So a generator has to search for a grid that works rather than take the first one it makes — which this page’s generator did not do until the test caught it producing a puzzle with three answers. It is also why the board stops at 5×5: at 6×6 the search needs dozens of candidate grids and each one costs a full solve.

How to use

  1. Fill every row and column with each height exactly once.
  2. Match the edge numbers: how many buildings are visible from there.
  3. Remember a taller building hides every shorter one behind it.
  4. Check your answer, or reveal the one grid that fits.

Frequently asked questions

What are the rules of Skyscrapers?

Each row and column holds every height exactly once, as in a Latin square. The numbers around the edge say how many buildings are visible looking along that line, where a taller building hides everything shorter behind it. A clue of 1 means the tallest building is at the front.

How many arrangements show exactly k buildings?

The unsigned Stirling numbers of the first kind — the same sequence that counts permutations by their number of cycles. For five buildings the counts are 24, 50, 35, 10 and 1, which sums to 120 as it must. Checked against the Stirling recurrence over every ordering up to eight buildings with no mismatches.

Can the two clues on one row add up to anything?

No. They can never total more than one more than the width of the board. The tallest building is visible from whichever side it faces and blocks the other, so a 3 and a 3 on a four-wide row is not hard, it is impossible. The pairs that hit the maximum are counted by binomial coefficients.

What does a clue of 1 mean in Skyscrapers?

That the tallest building is right at the front, hiding everything else. It is the second most useful clue after the maximum: exactly (n−1)! arrangements fit it, since the rest can be in any order at all.

Which clue number is the most common?

Two, at every board size from three to seven — not one, as most people would guess. At eight the mode moves again, to three, so the pattern you would infer from a small puzzle is already wrong on a bigger one.

Why do Skyscrapers puzzles use small grids?

Because most grids cannot be made into a puzzle. Over all 576 Latin squares of order four, 204 of them have a twin producing identical clues on all four sides, so no set of clues can distinguish them. At five and six the ambiguous share is around 96%, so a generator has to search for a usable grid rather than take the first one it makes.

Is every Skyscrapers puzzle uniquely solvable?

A properly made one is, and this generator confirms it by counting solutions rather than assuming. Clues are removed one at a time and put back whenever removing them would let a second answer in.

Does this send anything anywhere?

No. The puzzles are generated and checked in your browser.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.