A factorial puzzle

Adam Scherlis

A factorial puzzle

2025-02-25

Problem

I saw this post on Math Stack Exchange recently. Unfortunately, it got closed while I was solving it, so I emailed the OP a summary and am writing it up here.

In the course of some representation theory research, OP came across a mysterious function that produces, for each , a set of -tuples of natural numbers of size . They give some fairly gnarly Mathematica code to compute it, and ask for a simple characterization. They also list the sets for .

So there's actually three very different puzzles here, with the same answer. In increasing order of sophistication:

  1. Stare at the given sets until the pattern becomes clear.
  2. Reverse-engineer and golf the Mathematica code.
  3. Solve the original representation-theory problem.

I'm not feeling sophisticated, so we're going to do the first one.

Clues

There are a couple observations we can make about the given example sets:

  1. Per OP, they each consist of the vertices of a convex polytope which is combinatorially equivalent to the permutohedron.
  2. The edges of each polytope have coordinates that are all zero or one (in one orientation).

As a reminder, the standard -dimensional permutohedron is the convex hull of the permutations of the vector . (These lie in a hyperplane of codimension in .)

In other words, the vertices of the permutohedron are linear combinations of standard basis vectors, with the coefficients of each vector being a permutation of .

Guess

We will wildly conjecture that our mystery function gives a linear transformation of the standard permutohedron. Therefore, its vertices should be linearly combinations of some unknown set of vectors in , with the coefficients again being a permutation of .

What do we know about these vectors?

Consider the standard permutohedron again: every edge is a permutation of the vector , which is a difference of two standard basis vectors. These are also the edges of the -simplex formed by the standard basis vectors.

We know that the edges of our polytope are zero-one vectors, which is to say, edges and diagonals of the unit -cube. So it would make sense if the unknown vectors are the vertices of some -simplex embedded in that cube.

A little bit of squinting at the first few sets reveals that this almost works, for the simplex with vertices e.g. . It gives the correct shape, but translated away from the origin.

How do we translate back? Note that there is always one vertex of our polytope which is at least as close to the origin as any other corner along all axes simultaneously. This is the vertex whose coefficients are in decreasing order. The coordinates of that vertex are cumulative sums of the coefficients, i.e. triangle numbers.

So the polytope is just a permutohedron "jammed into the corner" of the positive orthant by a linear transformation, with coordinates given by cumulative sums of permutations with triangle numbers subtracted.

Solution

In equations:

The mystery set for is given by the vectors for with components given by

In Python:

import numpy as np
from itertools import permutations

for perm in permutations(range(n)):
    print(np.cumsum(np.array(perm) - np.arange(n))[:-1])