Skip to main content
3 of 4
added 92 characters in body
Bass
  • 80k
  • 8
  • 183
  • 369

Jaap (and many others) already solved the problem by calculus (and other kinds of maths), but this geometry based solution had such a nice symmetry to it that I wanted to post it anyway.

First, let's start by figuring out the general colour pattern. Given a single blue and N reds, where should we put the blue? Let's put a reds before the blue, and b reds after. Since our score is going to be "a times b", we can turn this into a geometry problem:

Maximize the area of this rectangle

enter image description here

The maximum is "obviously"

a square, with a = b. A longer rectangle would be thinner, and therefore have smaller area than the square. Or as the old multiplication rule says: "deviating from a square shape by 1 unit decreases the area by 1 unit". $$ (x+1)(x-1) = x^2-1$$

So the best spot for the blue lamp, and by extension, all the blue lamps is

smack in the middle of all the reds.

Then, we need to decide the number of blues we should add. Let's call it c. Each blue gives us "a times b" points, for a total of "a times b times c", so next we get to solve the exact same problem as before, except Now in 3D!

Maximize the volume of this rectangular box

enter image description here

As before, the intuitive answer is the correct one, and we get the maximum points with

a cube, that is, a = b = c. No matter which of the three coordinates we take out, the remaining two can always be improved unless they already make a square -> no other solution can be optimal.

So we should put

50 blue lamps in the middle, with 50 red lamps both before and after them

for a total of

$50^3$ grams (125 kg) of gold

which, if turned into a sphere of solid gold, would be just about the size of a standard bowling ball (diameter difference < 5%), and easily heavy enough to completely crush us. Maybe that was the genie's ulterior plan? Maybe we should figure out a less effective colouring, this deal seems suspiciously good for us..

Bass
  • 80k
  • 8
  • 183
  • 369