# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1684: In the fold

From New Scientist #2851, 11th February 2011 [link]

I have taken a square piece of paper with an area equal to a two-figure number of square centimetres.

The corners are labelled A, B, C and D clockwise around the square. I have folded the square with one straight fold so that the corner A lies midway between C and D. I have then opened up the sheet and measured the length of the fold line. It is an even number of centimetres.

How long is it?

[enigma1684]

### 2 responses to “Enigma 1684: In the fold”

1. jimrandell 8 February 2012 at 7:14 pm

The hard part of this is doing the trigonometry to determine the length of the fold, once that’s worked out it’s pretty obvious how long it is. And once I’d done the trigonometry it became apparent that there is a much easier way to find the length of the fold involving congruent triangles.

Nevertheless, here’s some code to check the answer (and it uses my new `printf()` function (from the enigma.py library) that interpolates variables into the print format string without you having to specify them as arguments).

```from enigma import is_square, printf

for A in range(10, 100):
(l2, r) = divmod(A * 5, 4)
if r > 0: continue
l = is_square(l2)
if l is None: continue
if l % 2: continue
printf("A={A} l={l}")
```

Solution: The fold is 10cm long.

The area of the square is 80 cm².

• jimrandell 9 February 2012 at 8:21 am

Here’s the diagram I used to determine the length of the fold:

Consider the square ABCD, of side 2l. (That’s the letter l).

The fold places A on E (the midpoint of CD), which makes ADE a right-angled triangle with hypotenuse l√5, and angle at A of θ.

The fold line itself is the perpendicular bisector of AE, labelled FG.

But the right-angled triangle FGH is congruent to ADE, with length FH being 2l and angle at F being θ.

Hence the length along the fold FG is also l√5.