**From New Scientist #2431, 24th January 2004**

That great artist Pussicato has painted a picture containing antelope, bears, cats and dogs. For aesthetic reasons he kept the following conditions:

Writing “a” for the number of antelopes in the picture, “b” for the number of bears and so on;

a + 6d = 2b + c + 20 unless a + 6d = 2b + c + 17;

a + d = b + 2c + 2 unless a + d = b + 2c + 1;

3a + 5d = 3b + 5c + 11 unless 3a + 5d = 3b + 5c + 12;

3b + 5c = 2a + 2d + 1 unless 3b + 5c = 2a + 2d + 3;

the total number of animals is odd unless it is divisible by 5.

How many of each animal are there in the picture?

[enigma1273]

### Like this:

Like Loading...

It is fairly straightforward to use SymPy to consider all the possible combinations of the first four simultaneous equations, and then look for solutions that match (exactly) one of the remaining conditions.

This Python program runs in 433ms.

Solution:There are 3 antelope, 1 bear, 2 cats and 3 dogs in the picture.If you solve the simultaneous equations manually (or use an LP solver, like I did for

Enigma 1278andEnigma 1292), you can then try the various combinations of the constants until you find one that matches the conditions.This Python program runs in 32ms.

The constants are: 17 for the first equation, 1 for the second equation, 11 for the third equation and 1 for the fourth equation.