# Sunday Times Teaser 2717 – Round the Garden

### by Danny Roth

All the sides of a quadrilateral shaped garden are whole numbers of metres, no two of which differ in length by a prime number. The lengths of the three longest sides are prime numbers and somewhere in the lengths of the four sides and the perimeter each of the digits 0 to 9 is used exactly once.

What are the lengths of the sides?

Here is an iterative solution:

and here is a recursive version:

Brian
I am a pen-and-paper solver and a lurker on your other site.
I think that your programs impose the ” no two sides differ by a prime” condition.I assume that they do not produce the second set which would solve the teaser if the condition was not included and which you mention on the other site..
This makes me wonder whether you also did an analytical solution (which I found to be an enjoyable exercise).
Regards
Tony Smith

Hi Tony,
No, I just ran one of the programs above without the lines that apply this condition. In fact, as I mention on my other site, I left out the ‘three largest primes’ condition as well.

there is a near-miss in the form a + b + cd + efg = hij which I will leave you to (re)discover.

the no-differences prime rules it out; also the fact that the four sides couldn’t form a quadrilateral in any case!