– I had a strange dream last night.

– Tell me all about it.

– I went to see car racing.

– I didn’t know you cared for cars.

– Before the race the cars were parked in a square fashion.

– What do you mean?

– There were equally many cars each column and row.

– You mean that there were a square numbers of cars?

– I guess you could put it like that.

– Then what?

– After the race they were parked in a rectangular shape with 5 more in each row than in the square lineup.

– How many were there in each column?

– You tell me!

The Royal Spanish Mathematics Society is 100 years old this year. The newspaper El País celebrates this with a math problem every week. The problem above is, in essence, one of them. Here is a video presenting the problem (in Spanish).

These Spanish problems have been difficult! Finally there is one I could solve.

There were 400 cars. First they lined up 20 by 20, then 16 by 25.

Can you show that there are no other solutions? If there is more than one solution the problem as stated can not be solved.

1,865 answers were sent to El Pais. About 60% of them were correct.

Let’s say the square is (x-5) by (x-5) and the rectangle is x by y.

We want x, y and x-5 to all be integers greater than 0.

xy = (x-5)(x-5)

y = (x-5)(x-5)/x

y = x – 10 + 25/x.

Now x must be positive, so if y is an integer then x can only be 1, 5 or 25. x=1 doesn’t work because x-5 < 1. x = 5 doesn't work for the same reason. The only one that satisfies the conditions is x = 25.

Thus x = 25, y = 16. The original square was 20 by 20, the rectangle is 20 by 16.