Enigmatic Code

Programming Enigma Puzzles

Enigma 1563: Drawing a line

From New Scientist #2726, 19th September 2009 [link]

Enigma is a piece of contemporary art. It consists of a solid white cuboid of sides 18 centimetres, 24 centimetres and some other length (which is not a whole number of centimetres).

On each face of the cuboid there is a straight red line a whole number of centimetres long going from the mid-point of one edge to the mid-point of another. The six lines together form a continuous route over the surface of the cuboid. The shortest two of the lines are of different lengths.

What are the lengths of the six lines?

[enigma1563]

Advertisements

One response to “Enigma 1563: Drawing a line

  1. jimrandell 22 February 2012 at 11:43 am

    The following Python program runs in 36ms.

    from itertools import count
    from enigma import sqrt, is_square
    
    # side semi-length c is not a whole number, so we need to
    # find hypotenuses with both the other sides that are
    
    # if the two shortest lines are different lengths they are
    # across the 18 and 24 cm faces, so we can start looking
    # for hypotenuses 25cm or longer.
    
    (a, b) = (9, 12)
    for hac in count(25):
      hbc = is_square(b * b + hac * hac - a * a)
      if not hbc: continue
      # what is the third dimension?
      print("2c", "=", 2 * sqrt(hac * hac - a * a))
      # print the length of the lines
      print("lines:", sorted((2 * a, hbc, hac, 2 * b, hac, hbc)))
      break
    

    Solution: The lengths of the lines are 18cm, 24cm, 31cm, 31cm, 32cm and 32cm.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: