Enigmatic Code

Programming Enigma Puzzles

Enigma 997: Building sites

From New Scientist #2152, 19th September 1998 [link]

A small building site is offered for sale, divided into three plots, each at the same price per acre.

The plots are all rectangles of different sizes but each is the same shape as the overall site — that is, the ratio of the sides is the same for each, although two of the rectangles are rotated through 90° relative to the other two.

If the asking price of the largest plot is £20,000 more than that of the smallest, how much is the middle-sized plot?


One response to “Enigma 997: Building sites

  1. Jim Randell 16 August 2019 at 9:56 am

    If the cost of the medium sided plot is k, and it has long side length a and short size length f.a then we can write:

    k = f.a²

    (equating area and cost).

    The smallest plot, has long side f.a (the same as the shortest side of the medium plot) and so its shortest side is f².a.

    And its area (and hence cost) is:

    (f.a)(f².a) = k.f²

    The largest plot has longest side equal to a(1 + f²) (the sum of the shortest side of the smallest plot and the longest side of the medium plot). And so the shortest side is f.a(1 + f²), giving an area (and cost) of:

    a(1 + f²) . f.a(1 + f²) = f.a² (1 + f²)² = k(1 + f²)²

    And the difference between the costs is £20,000, so:

    k(1 + f²)² – k.f² = 20000

    writing: x = f², we have:

    k = 20000 / ((1 + x)² – x) = 20000 / (1 + x + x²)

    So, if we knew x, we could calculate k.

    If we look at the long side of the site we know it is the sum of the short side of the largest plot and the short side of the medium plot, which is:

    fa + fa(1 + f²) = fa(2 + f²)

    And f is the ratio of the short side to the long side of any of the rectangles and the site. Applying this to the site we get:

    a(1 + f²) / fa(2 + f²) = f
    1 + f² = f²(2 + f²)

    substituting x for :

    1 + x = x(2 + x)
    x² + x = 1
    x² + x + 1 = 2


    k = 20000 / (x² + x + 1) = 20000 / 2 = 10000

    Solution: The cost of the middle sized plot is £10,000.

    We can use the equation x² + x = 1 to calculate x and hence f:

    x = (–1 + √5)/2 ≈ 0.618
    f = √x ≈ 0.786

    Here is a simple program to determine numerical values for x, f and the cost of the plots:

    Run: [ @repl.it ]

    from enigma import find_value, sqrt, fdiv, printf
    # calculate x, f
    r = find_value(lambda x: x * (x + 1), 1, 0, 1)
    x = r.v
    f = sqrt(x)
    # calculate the cost of the plots
    x1 = x + 1
    k = fdiv(20000, 1 + x * x1)
    plots = [ k * x, k, k * x1 * x1 ]
    plots = list(round(v, 2) for v in plots)
    printf("x = {x}, f = {f}, plots = {plots}, sum = {t}", t=sum(plots))

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: