We weren't satisfied with knowing just a couple of good combinations, we wanted to know how one could work out the optimum number of slices for any brownies.

The maths:

If we assume a rectangular pan, and we divide the longest side into 'a' slices, then we need to work out how many slices we need to cut the shorter side into (we'll call this 'b') in order to have an equal number middle and edge slices (we'll call the number of middles 'm' and the number of edges 'e' as we did before).

Now, we know that the number of edge peices is simply the circumference of our pan, so:

e = 2(a+b)-4

*(adapted from our square-tin circumference equation)*

We also know that the number of middle pieces is found by multiplying the sides, minus the ones that are touching the edges (ie, 2 per side) so:

m = (a-2)(b-2)

Now, we want the same middle as edge, so

m = e

(a-2)(b-2) = 2(a+b)-4

So, if we solve this to calculate b for a given a:

Liz gets full credit for doing this. I cheated and consulted WolframAlpha, mostly to get the pretty pictures of the steps for solving the above.The solution Liz (and then Wolfram) came to looked like this:

And with a little tarting up, I present to you (drumroll please)

**The Equation for Equating Brownie Edge and Middle Peices:**

Notice, firstly, that there's no solution for having 4 slices on the longest side.

Oh, you want a graph of that? Really? Go on then:

**Graph of middle:edge brownie equality for a rectangular tin:**

**x-axis: Slices on Longer side**

**y-axis: Slices on Shorter side**

In this graph you can clearly see a few of our favourite combinations. 8x6 is on there, as is 12x5.

You can also clearly see that there's no whole-number solution below 4, and no solution at all at 4.

If we consider whole-number (discrete) solutions only, we can build the sequence:

- 5 x 12
- 6 x 8
- 8 x 6
- 12 x 5

And since 4 is not a solution, we've just defined our complete set of possible solutions. So if you want an equal number of edge to middle brownie slices, you have a choice of 48 or 60 brownies in a 8x6 or 12x5 configuration.

I'll stop maths-geeking out now, I promise...