Skip to main content
6 of 26
added 52 characters in body
Noodle9
  • 20.4k
  • 3
  • 23
  • 47

Python, 262 \$\cdots\$ 248 230 bytes

import math def f(l): n=len(l) if n<2:return 1 R=range p=sorted([sum((l[i][k]-l[j][k])**2for k in R(len(l[0])))for i in R(n)for j in R(n)]) d=len(f"{n:b}")-1 e=[] for i in R(d+2):e+=[i*p[n]]*2**d*math.comb(d,i) return p==e 

Try it online!

Very verbose, and may have some bugs, but here's something to kick us off.

How

Calculates the square of the distances between all possible pairs of points (including self-pairs) and normalise them by the first non-zero length. For a cube we should then see a pattern of integers \$i = 0\dots d\$ occurring \$2^{d}{d \choose i}\$ times where \$d\$ is the dimension of the cube.

Noodle9
  • 20.4k
  • 3
  • 23
  • 47