[seqfan] Number of orders of distances to vertices of n-dimensional cube

Pierre Abbat phma at bezitopo.org
Mon Nov 14 10:34:52 CET 2022

Let C be an n-dimensional cube and p be a point in R^n such that the distances 
from p to the 2^n vertices of C are all different. Write the vertices in order 
of their distance from p. How many different orders of vertices are there?

I'm writing an algorithm to search an octree for the two closest points to a 
given point p. Usually one of them will be p. I search the eight subcubes in 
order of their distance from p, so that I can ignore farther subcubes 
entirely, knowing that the distance to the closest points is less than the 
distance to the subcube. There are 96 orders, but I'm using only 48 to 
simplify the code, using e.g. {0,1,2,3,4,5,6,7} but not {0,1,2,4,3,5,6,7}.

The sequence begins 1,2,8,96. There are four sequences beginning 1,2,8,96, of 
which one has offset 1,2 so I discard it. I suspect it's the map-folding 
sequence A001417, since the next term 4608 is divisible by 2^4×4!, but my 
four-dimensional intuition is not good enough to verify it without writing 
some code, and I need to write only the code for n=3 because someone needs it 
for a device.

Take a set of n real numbers {x[0]..x[n-1]}. Take all 2^n subsets of the set, 
sum each subset, and make sure they're all different. The nth term of the 
sequence (starting at n=0) is the number of different orders the sums can be 

Don't buy a French car in Holland. It may be a citroen.

More information about the SeqFan mailing list