# Enigmatic Code

Programming Enigma Puzzles

## Tantalizer 443: Roses, roses all the way

From New Scientist #994, 1st April 1976 [link]

Our local council recently planted some white rose bushes but they all died. So they replaced each bush with as many red rose bushes as they had originally planted white bushes. These all died too. Gritting their teeth, the replaced each red bush with as many yellow rose bushes as they had previously planted red bushes. This time they were luckier. Only as many yellow bushes died as red bushes had died before.

Moved by such dogged devotion to horticulture, twelve leading citizens offered to pay for all the surviving yellow bushes, provided that meant that each could pay for the same number of bushes. The Council have lost their record of the number of survivors and do not have the face to spend ratepayers’ money of getting them counted. Yet they would like to know whether they are in a position to accept the offer.

Can you help?

[tantalizer443]

### 2 responses to “Tantalizer 443: Roses, roses all the way”

1. Jim Randell 17 October 2018 at 8:16 am

If n is the original number of white rose bushes, then n^2 red bushes were planted, and n^4 yellow bushes. The number of surviving yellow bushes is S(n) = (n^4 – n^2) which we can factorise as:

S(n) = (n – 1)n^2(n + 1)

And we want to know if 12 (= 2×2×3) divides this.

S(n) is the product of 3 consecutive numbers, multiplied by the middle number again.

So, one of the three consecutive numbers must be divisible by 3.

And, if the middle number is even, then when it is squared it will have 2 factors of 2, and if it is not even, then the other two numbers must be even and each of those has a factor of 2.

So whatever the number it will always be divisible by 12.

Solution: Yes, the number of surviving bushes is divisible by 12.

A quick Python expression verifies this.

```>>> list(n for n in irange(1, 100) if (n ** 4 - n ** 2) % 12 != 0)
[]
```

This checks for n up to 100, which means up to 10,000 red bushes are considered and up to 100,000,000 yellow bushes, which seems like quite a lot.

As expected, we do not find any values for n where S(n) is not divisible by 12.

We’ve come across the integer sequence: (n^4 – n^2) / 12 before, specifically in Enigma 1723 as the number of squares that can be made on an n × n grid of pins using an elastic band.

2. Tessa Fullwood 17 October 2018 at 10:28 pm

N^4 – N^2 has factors N N (N-1) (N+1). The consecutive numbers must mean the expression is divisible by three. Also either N -1 and N + 1 are both even or N and N are even. Hence the expression is divisible by four, hence overall divisible by 12.

This site uses Akismet to reduce spam. Learn how your comment data is processed.