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

Python, 262 \$\cdots\$ 250 248 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)]) p=[x//p[n]for x in p] d=len(f"{n:b}")-1 e=[] for i in R(d+2):e+=[i]*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