Comment by periodontal

Comment by periodontal 21 hours ago

1 reply

For an easy strategy, guess all zeros at first. Call resulting distance E1 and let S1 = E1 × E1.

Now guess with X = 1, rest still zero, obtaining S2. We can calculate X = (S1 - S2 + 1)/2.

Now guess (X, 1, all zeroes). Do the same calculation as above to obtain Y, except use S1 - X × X in place of S1.

You can repeat as needed for the other coordinate(s). However, the last coordinate requires no guessing since it's a known straight line distance from an extremal point. So you can calculate it directly (e.g., W = sqrt(S1-X×X-Y×Y-Z×Z) for 4D).

This guarantees you can solve any 4D in 5 guesses.

For the case you mention with rounding, I'm pretty sure it's still possible. If your probing guess for each coordinate uses the maximum value instead of 1 (e.g., 999 for 3 digits), it'll ensure that at least one guess is 500 away from the correct value, making at least one of them very sensitive to the exact distance. Then you do something like X=(S1 - S2 + 999×999)/(2×999). This likely breaks down in high enough dimensions (guessing 100+) due to distance being less sensitive on average to wild perturbations in any one coordinate. There might also be issues with intermediate rounding while calculating the distance if using doubles or similar.

bills-appworks 13 hours ago

Thanks for the advice.

I’m sorry I can’t give a fully clear response right away, but it does look like your logic can indeed be used to compute the correct answer.

It’s a mathematically fascinating approach as well — thank you for sharing it.