An ant walks in constant steps from corner to corner over a rectangular box, always chosing the shortest path. From any given corner, the ant observes the shortest paths to the other seven corners all to equate to an integer number of ant steps.

enter image description here

What are the ratios between the linear dimensions of the box?

  • $\begingroup$ Can we think of it as all of the paths being integer distances or does this exclude potential solutions? $\endgroup$
    – Quark
    Jan 31, 2015 at 5:51
  • $\begingroup$ @Quark - yes, this is to be approached as an integer distances (diophantine) problem for the corner-to-corner geodetics on a cuboid. $\endgroup$
    – Johannes
    Jan 31, 2015 at 6:19
  • $\begingroup$ After reading the Euler brick link, I see that no-one knows if there is a solution when you replace the ant with a fly. $\endgroup$
    – Callidus
    Feb 2, 2015 at 13:19

2 Answers 2


Let the rectangular box sides be a,b and c. Call integers x,y a pythagorean double if $x^2 + y^2 = z^2$ for some integer z.

Clearly a,b and c must be integers; that's three paths. Also, any two of them must form a pythagorean double so that the ant can get from one corner of a face to the opposite corner. That means a,b and c must be distinct.

Finally $(a+b),c$ must form a pythagorean double (where c is the longest side), so that the ant can get from one corner to the opposite corner of the box. So far so good. This means c must form a pythagorean double with a, with b, and with a+b; and a,b must form a pythagorean double.

One such set of numbers is:

a = 44, b = 117, c = 240 - these are the ratios of the sides of the box.
These give pythagorean triples of 44,117,125; 44,240,244; 117,240,267; 161,240,289
So the other four path lengths are (some multiples of) 125, 244, 267 and 289.

There may be others.

  • $\begingroup$ Your last part says that (a+b) and c must be Pythagorean doubles. But I'm confused. Shouldn't [(b+c) and a] and [(a+c) and b] also be Pythagorean doubles? $\endgroup$
    – EFrog
    Feb 1, 2015 at 13:14
  • 1
    $\begingroup$ @Efrog that's the path from one corner of the box to the furthest corner. There are three such paths as you say, but a+b, c is the shortest and the question specifies shortest path. $\endgroup$
    – Callidus
    Feb 1, 2015 at 20:21
  • 1
    $\begingroup$ "There may be others" - correct, but extensive searches reveal that if others exist, the number of steps required will go well beyond the capabilities of an average ant... $\endgroup$
    – Johannes
    Feb 2, 2015 at 19:56

What you are basically looking for is a Euler brick.

Some solutions listed there are:
(85, 132, 720) — (157, 725, 732)
(140, 480, 693) — (500, 707, 843)
(160, 231, 792) — (281, 808, 825)
(240, 252, 275) — (348, 365, 373)


I would like to add that, as @Quark mentioned, only the first one actually works for the last diagonal (integer length for $\sqrt{(a+b)^2+c^2}$), which I forgot to take into account.

  • 1
    $\begingroup$ None of these fit the furthest diagonal requirement. It's pretty cool though that only the first one on the wiki (and the smallest) is the one that works. $\endgroup$
    – Quark
    Feb 1, 2015 at 5:39
  • $\begingroup$ @ghosts_in_the_code : the first one you list (85, 132, 720) does not work. The only one that works is the smaller one you didn't include (44, 117, 240). $\endgroup$
    – Johannes
    Feb 2, 2015 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.