The question
Let $C = [-1,1]^n$. Its $2n$ facets are the sets $F_i^{\varepsilon} = \{x \in C : x_i = \varepsilon\}$, one for each coordinate $i$ and each sign $\varepsilon$. Two facets are adjacent when they meet in an $(n-2)$-face, which is the joining rule from the Code Golf challenge the problem comes from. A $k$-polyfacet is a connected set of $k$ facets, and $T(n,k)$ counts them up to the symmetries of $C$. The empty set is counted, so $T(n,0) = 1$.
How many $k$-polyfacets live on the $n$-cube?
On the ordinary cube the whole answer fits in one picture. There are two $3$-polyfacets and two $4$-polyfacets, and exactly one polyfacet of every other size.
Kagey's page gives the table of $T(n,k)$ for $2 \le n \le 10$ and notes that its rows are palindromes with two exceptions.
| $T(n,k)$ | $0$ | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$ | $11$ | $12$ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| $n=2$ | 1 | 1 | 1 | 1 | 1 | ||||||||
| $n=3$ | 1 | 1 | 1 | 2 | 2 | 1 | 1 | ||||||
| $n=4$ | 1 | 1 | 1 | 2 | 3 | 2 | 2 | 1 | 1 | ||||
| $n=5$ | 1 | 1 | 1 | 2 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | ||
| $n=6$ | 1 | 1 | 1 | 2 | 3 | 3 | 4 | 3 | 3 | 2 | 2 | 1 | 1 |
Pairs decide everything
Write $P_i = \{F_i^{+}, F_i^{-}\}$ for the $i$-th opposite pair. Two observations do all the work.
Two distinct facets are adjacent if and only if they are not opposite. A set of facets is disconnected if and only if it is a single opposite pair.
For $i \ne i'$ the intersection $F_i^{\varepsilon} \cap F_{i'}^{\delta}$ is the $(n-2)$-face on which $x_i = \varepsilon$ and $x_{i'} = \delta$, while $F_i^{+} \cap F_i^{-}$ is empty. So the adjacency graph is the complete graph on the $2n$ facets with one perfect matching deleted, the cocktail party graph. Take a set $S$ with $|S| \ge 3$ and two members $a, b$. If they are not opposite they are adjacent. If they are opposite, any third member is adjacent to both, since a facet has only one opposite. A two-element set is connected exactly when its two facets are not opposite.
A symmetry of $C$ fixes the centre, so it is linear and orthogonal, and it permutes the unit normals $\pm e_1, \dots, \pm e_n$. The symmetry group is therefore the group $B_n$ of signed permutation matrices, of order $2^n n!$. Writing $g = (\pi, \sigma)$ for the element with $g e_i = \sigma_i e_{\pi(i)}$,
$$g\,F_i^{\varepsilon} = F_{\pi(i)}^{\sigma_i \varepsilon}.$$So $g$ carries $P_i$ to $P_{\pi(i)}$ and decides separately whether to swap the two facets inside it. Every permutation of the pairs combined with every choice of swaps occurs, and occurs once.
The type of a set $S$ of facets is the triple $(j, s, e)$ counting the pairs $P_i$ with $|S \cap P_i|$ equal to $2$, to $1$ and to $0$. It satisfies $j + s + e = n$ and $|S| = 2j + s$.
Two sets of facets lie in the same orbit if and only if they have the same type, and the orbit of a set of type $(j,s,e)$ has $\frac{n!}{j!\,s!\,e!}2^{s}$ elements.
The type is invariant because $|gS \cap P_{\pi(i)}| = |S \cap P_i|$. For the converse, match the full pairs of one set to the full pairs of the other, the singles to the singles and the empties to the empties, then set the signs on the single pairs to carry the chosen facet to the chosen facet. A polyfacet is a type, and nothing else.
The closed form
For $n \ge 2$ and $0 \le k \le 2n$,
$$T(n,k) = 1 + \min\left(\left\lfloor \tfrac k2 \right\rfloor,\ n - \left\lceil \tfrac k2 \right\rceil\right) - [k = 2].$$The $k$-polyfacets are the types $(j,\ k-2j,\ n-k+j)$ for $\max(0, k-n) \le j \le \lfloor k/2 \rfloor$, with $j = 1$ omitted when $k = 2$.
The orbits of $k$-sets are the types with $2j + s = k$. Given $j$ the type is forced to be $(j, k-2j, n-k+j)$, and it exists exactly when $k - 2j \ge 0$ and $n - k + j \ge 0$. That is an interval of $\lfloor k/2 \rfloor - \max(0, k-n) + 1$ values of $j$, and since $\lfloor k/2\rfloor - (k-n) = n - \lceil k/2 \rceil$ this count is $1 + \min(\lfloor k/2\rfloor, n - \lceil k/2\rceil)$. Every one of those orbits consists of connected sets except the type $(1, 0, n-1)$, which occurs only for $k = 2$.
Three consequences follow at once. For $k \le n$ the value is $\lfloor k/2 \rfloor + 1 - [k=2]$ and does not depend on $n$. The rows satisfy $T(n,k) = T(n, 2n-k)$ away from $k \in \{2, 2n-2\}$, since complementation sends the type $(j,s,e)$ to $(e,s,j)$ and the complement of an opposite pair is connected as soon as $n \ge 3$. And each row sums to $\binom{n+2}{2} - 1$.
One correction to the problem page. It prints the palindrome as $T(n,k) = T(n,n-k)$ with exceptions at $k \in \{2, n-2\}$, and $2n$ is meant in both places. The claim $T(n,2n-2) = 2$ also needs $n \ge 3$, because $T(2,2) = 1$.
The triangle is OEIS A384157, contributed by Kagey and von Brömssen in May 2025. Its comments already state the classification by pairs and give the generating function
$$\sum_{n \ge 1} \sum_{k} T(n,k)\,x^k y^n = \frac{1}{(1-y)(1-xy)(1-x^2y)} - \frac{x^2 y}{1-y} - 1.$$No proof is recorded there and the problem page still lists the question as open, so what is new is the proof and not the count. Drop the correction at $k = 2$ and the rows become the coefficients of the Gaussian binomial $\binom{n+2}{2}_q$, which is A008967.
Colourings, fixed, one-sided
Related questions 1 and 3 come out of the same description.
The number of fixed $k$-polyfacets, with no identification at all, is $\binom{2n}{k} - n\,[k=2]$. For $n \ge 2$ the number of one-sided $k$-polyfacets, up to rotations only, is again $T(n,k)$.
The first half is the lemma restated: only the $n$ opposite pairs fail to be connected. The second says no polyfacet of the $n$-cube is chiral. To see it, produce for any set $S$ a symmetry of determinant $-1$ fixing $S$. If $S$ has a full or an empty pair $P_i$, the reflection $x_i \mapsto -x_i$ fixes $S$. Otherwise all $n \ge 2$ pairs are single, and the reflection that exchanges two of the chosen facets does it.
Now drop connectivity and colour the facets with colours $1, \dots, c$. The content of a colouring is the vector $(m_1, \dots, m_c)$ of how many facets carry each colour.
(a) Up to the symmetries of the cube, colourings correspond to multisets of $n$ unordered pairs of colours, repeats allowed. There are $\binom{\binom{c+1}{2}+n-1}{n}$ of them, and the number with content $(m_1,\dots,m_c)$ is the coefficient of $t^n x_1^{m_1}\cdots x_c^{m_c}$ in $\prod_{a \le b}(1 - t\,x_a x_b)^{-1}$.
(b) A colouring is chiral exactly when its $n$ colour pairs are distinct and none of them repeats a colour. Up to rotations the count is therefore $\binom{\binom{c+1}{2}+n-1}{n} + \binom{\binom{c}{2}}{n}$, and by content one adds the coefficient in $\prod_{a<b}(1 + t\,x_a x_b)$.
The map is to send a colouring $\chi$ to the multiset of the $n$ pairs $\{\chi(F_i^{+}), \chi(F_i^{-})\}$. For $n = 3$ these are the classical counts for the faces of a cube, $1, 10, 56, 220$ up to all symmetries and $1, 10, 57, 240$ up to rotations. The two totals are Russell's arrays A325005 and A325004, stated there without proof. The refinement by content we did not find in either entry.
Take $c = 2$ and part (a) counts the ways to mark $k$ facets with no connectivity condition. It gives $1 + \min(\lfloor k/2 \rfloor, n - \lceil k/2 \rceil)$, the uncorrected row. Part (b) adds nothing for $n \ge 2$, since $\binom{1}{n} = 0$.
Most and least symmetric
A set of facets of type $(j,s,e)$ has symmetry group $B_j \times S_s \times B_e$, of order $j!\,s!\,e!\,2^{\,j+e}$.
Divide $2^n n!$ by the orbit size. On the cube this gives orders $6$ and $4$ for the two $3$-polyfacets and $4$ and $16$ for the two $4$-polyfacets, the numbers printed under the first figure. Fix $n$ and $k$ and write $f(j) = j!\,(k-2j)!\,(n-k+j)!\,2^{\,n-k+2j}$ for the order belonging to the type with $j$ full pairs.
Let $n \ge 3$ and $3 \le k \le 2n-2$, so that there is more than one polyfacet to compare.
(a) The most symmetric $k$-polyfacet is the one with the most opposite pairs, $j = \lfloor k/2\rfloor$, except when $k = n$ is odd. In that case it is the one with no opposite pair, the $n$ facets meeting at a vertex, whose group is $S_n$. The maximum is attained once.
(b) The least symmetric has $j^{*}$ opposite pairs, where $j^{*}$ is the least $j$ in range with $4(j+1)(n-k+j+1) \ge (k-2j)(k-2j-1)$, and $j^{*} = \lfloor k/2 \rfloor$ if there is no such $j$. It is attained once unless equality holds at $j^{*}$, when the types $j^{*}$ and $j^{*}+1$ tie.
The proof is one ratio. For consecutive types,
$$\frac{f(j+1)}{f(j)} = \frac{4(j+1)(n-k+j+1)}{(k-2j)(k-2j-1)},$$whose numerator increases in $j$ and whose denominator decreases, so the ratio is strictly increasing. Therefore $f$ falls while the ratio is below $1$ and rises afterwards. That is part (b), and it puts the maximum at an end of the range. Which end takes a short calculation with central binomial coefficients, and complementation carries the case $k > n$ back to the case $k < n$.
The inequality in (b) is roughly $j \ge k^2/4n$. That is the expected number of full pairs in a random $k$-set of facets, which is what it should be, because the least symmetric type is the one with the largest orbit. Ties do occur. The first is $n = 6$, $k = 4$, where the types $j = 0$ and $j = 1$ both have group order $192$.
Other polytopes
Related question 2 asks the same thing on the simplex, the orthoplex and the demicube, and for faces of lower dimension. The simplex is settled. The orthoplex is identified with a known triangle and gets no closed form. The demicube is not treated here.
The $n$-simplex has $n+1$ facets, any two of which meet in an $(n-2)$-face, and $S_{n+1}$ induces every permutation of them. So every set of facets is connected, all $k$-sets are equivalent, and every entry of the table is $1$.
The $n$-orthoplex is another matter. Its facets are indexed by sign vectors $\varepsilon \in \{\pm1\}^n$, and two of them share an $(n-2)$-face exactly when the vectors differ in one coordinate. So the facet graph is the hypercube graph $Q_n$, and $B_n$ is its full automorphism group. The $k$-polyfacets are the connected induced $k$-vertex subgraphs of $Q_n$ up to automorphism, which is von Brömssen's A369605. Row $n = 4$ is
$$1, 1, 1, 3, 5, 11, 19, 36, 37, 41, 24, 18, 6, 4, 1, 1,$$and we recomputed rows $2$ through $4$. No closed form is to be expected. For $k \le n+1$ the entries are the orthoplex polyominoes of A049540, which are known only to $k = 10$.
Faces of dimension $d < n-1$ fall outside the argument. It used two features of facets. The group acts on them as the full group of permutations preserving the pairing, so an orbit of subsets needs only two numbers to name, and adjacency is dense enough that connectivity is almost automatic. Neither survives the drop in dimension. For $d = 1$, edges joined at vertices, the count is Kagey's A333333, whose row $n = 4$ already runs past a million.
What was checked
Every statement above was computed from the definitions before it was written down. The script in the repository runs 30 checks in a few seconds.
- The facets of $[-1,1]^n$ are built as vertex sets, and two are called adjacent when they share $2^{n-2}$ vertices. For $n \le 6$ that relation is exactly "not opposite". For $n \le 4$ the $2^n n!$ signed permutations are the full automorphism group of the resulting graph, tested against all $(2n)!$ permutations of the facets.
- For $n \le 6$ and all $2^{2n}$ sets of facets, $T(n,k)$ is computed twice without reference to types: by marking orbits under the explicit group with connectivity tested by graph search, and by the orbit-counting lemma. Both give the theorem. The formula matches every entry of Kagey's table to $n = 10$, the 80 published terms of A384157, and the generating function to $n = 60$.
- The same two methods over the rotation subgroup confirm that one-sided and free counts agree. Stabiliser orders come from orbit sizes for $n \le 6$ and from counting the group elements that fix a representative for $n \le 5$. The extremal statement is checked against explicit orbits for $n \le 6$ and against direct evaluation of $f(j)$ for $n \le 60$.
- Colourings are counted for 18 pairs $(n,c)$ with $n, c \le 5$, up to $65{,}536$ colourings, three ways: orbit marking, marking refined by content, and the orbit-counting lemma $\frac{1}{|G|}\sum_g c^{\,\mathrm{cyc}(g)}$.
- The simplex is checked to $n = 6$ and the orthoplex to $n = 4$ against A369605.
For this page the numbers were recomputed a second time by a separate script that classifies orbits by canonical form rather than by marking, counts colourings by Pólya's cycle index, and compares every quoted sequence term by term against the OEIS entry itself. Nothing disagreed.
What is open
Nothing above is conjectural. The main question is proved, so are the three related questions on colourings, on fixed and one-sided polyforms, and on extremal symmetry, and the remaining statements are finite computations.
What is left is part of related question 2 and all of related question 4. The demicube is untouched. So is the $\ell \times \cdots \times \ell$ "Rubik's" subdivision, where a cell is no longer named by a coordinate and a sign, which is the one fact the whole argument runs on. Faces of dimension $d < n-1$ on the cube are a different problem, with no reason to expect a closed form. The orthoplex has a triangle and no formula.