conjecscore
Login Sign up

Leaderboard

Minmax Point Distance Squared

The Problem

Consider arranging \(n\) distinct points at integer coordinates on the plane. How do you minimize the maximum squared distance between any two points with the additional constraint that all distances between points are distinct? OEIS provides optimal solutions when \(n = 2, \ldots, 13\). What can be said about \(n = 28\)?

Submission Format

Please input a CSV with \(56\) integers. Each \(2\) integers corresponds to a point on the plane. Let \(\mathcal{D}\) be the set of all squared distances between each \(2\) points. Your goal is to minimize $$\max\{\mathcal{D}\}$$ subject to the constraint that \(|D| = {28 \choose 2}\).

Score Implementation

The following is a Python implementation of the score function to help you get started.


from itertools import combinations, batched


def score(nums: [int]):
    N = 28
    # Looking for a length 14 points.
    if len(nums) != 2 * N: # Remember each point is 2 values.
        return None

    # Must be integers
    for num in nums:
        if int(num) != num:
            return None
    # Require 14 distinct points
    points = list(batched(nums, 2))
    if len(set(points)) != N:
        return None

    squared_dists = []
    for p1, p2 in combinations(points, 2):
        squared_dist = (p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2
        squared_dists.append(squared_dist)

    # All distances must be distinct!
    if len(squared_dists) != len(set(squared_dists)):
        return None

    # We allow starting at any number so the order is max - min.
    return max(squared_dists)