From The Sunday Times, 3rd May 1992 [link]
This week, I share a find-the-next-row puzzle that is doing the rounds of dons’ whiteboards:
1
1 1
2 1
1 2 1 1
?
To avoid invasion of ivory towers, I will give you the answer:
1 1 1 2 2 1
with the explanation that, starting with the initial 1, each subsequent row is obtained by reading the previous row. Thus, row five is formed (with reference to row four) from one “one”, followed by one “two”, and terminating with two “one”s.
However, I do have four questions about the first billion rows of this sequence.
1. What is the largest digit that can be found anywhere?
2. What is the largest number of ones that can occur consecutively in any single row?
3. Repeat (2), looking for twos instead.
4. Repeat (2), looking for threes instead.
Multiply each answer by its question number and send in the total.
This puzzle is included in the book Brainteasers (2002), in which it appears in the following form:
Read me!
Consider the sequence:
1
11
21
1211
111221
312211
…
You might like to try and work out the next few terms before reading on and trying the rest of this Teaser.
In fact, having started with 1, each subsequent term simply reads the previous line. So, for example, after 111221 we note that this consists of:
three ones, two twos, one one
i.e. the next term is simply:
312211
Here are some questions about the first billion terms of this sequence:
(a) What is the largest number of consecutive ones in any term?
(b) What is the largest number of consecutive twos in any term?
(c) What is the largest number of consecutive threes in any term?
(d) What is the largest digit which can be found in any term?
[teaser1547]
Jim Randell 9:06 am on 20 April 2019 Permalink |
If B and C’s gates are at a distance of d apart N-S across the park, and distances b and c from a corner X, then (b, c, d) form a Pythagorean triple.
Once we have a suitable Pythagorean triple we can extend the lines XB and XC by lengths of 2d and bend them (at integer values) so that the bent sides form the third side of the triangle, which meet at A’s gate.
If this is possible we have a viable solution. We then need to find which solution places A’s gate closest to a corner of the park.
This Python program finds candidates solutions and choose the one with the smallest distance from A’s gate to a corner. It runs in 108ms.
from enigma import (pythagorean_triples, irange, div, Accumulator, printf) # find the minimum distance of A from a corner r = Accumulator(fn=min) # BCX is right angled triangle with integer sides for (x, y, z) in pythagorean_triples(5280): for (b, c, d) in [(z, x, y), (z, y, x)]: # check 5d + b + c = 5280 yards if not (5 * d + b + c == 5280): continue # now consider possible integer values for y for y in irange(1, 2 * d - 1): # compute viable z (using the cosine rule) p = (b - c) * (b * b + b * (4 * d + c) + 4 * d * (c + 2 * d - y)) q = 2 * (b * b + b * (2 * d + y) + c * (y - c - 2 * d)) z = div(p, q) if z is None or not (0 < z < 2 * d): continue # compute the sides of the park (A, B, C) = (y + z, b + 2 * d - z, c + 2 * d - y) # A is on the shortest side and C is on the longest side if not (A < B < C): continue # additional: the park is a right angled triangle #if not (A * A + B * B == C * C): continue printf("[A={A} B={B} C={C}, d={d} b={b} c={c}, y={y} z={z}]") r.accumulate_data(min(y, z), (A, B, C, d, b, c, y, z)) # output the solution printf("min distance for A from a corner = {r.value} yards [{r.count} solutions]")Solution: The shortest distance A’s gate can be from a corner is 135 yards.
The program finds 8 possible solutions:
The last of these has the smallest value for y or z.
So the park looks like this:
However, apparently this was not the intended answer to this puzzle. The puzzle text should have said that the park was a right angled triangle, but this extra condition was omitted when the puzzle was published.
We can remove solution candidates that are not right-angled triangles by uncommenting the check at line 29.
If we do this we find that only one of the solutions remains:
The shortest distance being 275 yards.
In this case the park looks like this:
However, given there is only a single solution it seems odd to have the statement: “Alan is as near to one corner as possible”. It would make more sense to just ask: “How far is Alan from the nearest corner?”.
LikeLike