**From New Scientist #2875, 28th July 2012** [link]

From a point on one side of a rectangular sheet of paper I drew two straight lines, one of them to a point on one adjacent side and the other to a point on the other adjacent side. My sheet of paper was now divided into two triangles and a pentagon. The lengths of the sides of the triangles were all integers, the lengths of the sides of the pentagon were, in some order, five consecutive integers, each less than 50.

What were the dimensions of the sheet of paper?

**Note:** It might have been clearer if the puzzle talked about the *edges* of the sheet of paper, rather than the *sides* of the corresponding rectangle.

[enigma1708]

### Like this:

Like Loading...

Here’s my first attempt. It runs in 43ms, but I’m not entirely happy with it. I lifted the generator for Pythagorean triples from a Project Euler problem I was looking at.

Here’s a diagram to illustrate how I tackled the problem.

Solution:The dimensions of the sheet of paper are 37 x 66.Here’s a slightly modified approach. It generates all possible Pythagorean triples with a hypotenuse less than 50 up front, and then checks all pairs of them. This does away with the

exit()for termination, and hence checks all possible answers, instead of stopping at the first one. It runs in 37ms.I probably should have done this one in SQL, but here is some Python: