Minecraft Maths

So, I woke up at 6:00 this morning and, as one does, I ended up passing the time by thinking about how many possible crafting recipes one could make using any number of an item in the standard Minecraft 3×3 crafting grid… I know, right. Don’t worry, it gets better.

I thought, OK, 9 ways to put 1 item in, 1 way to put 9 in… I got up to “36 ways to put 2 in” before I decided it was probably going to be a lot of work counting all the possible combinations in a 9 cell grid, so I thought, why not come up with a formula for it to save myself some trouble?

I started out with a 1 cell grid; easy. There was only 1 possible combination, of course. Then I moved up to 2 cells: 3 combinations. 3 cells: 7 combinations. 4 cells: 15 combinations.

By this point I decided that lying in bed, doing it all in my head, I could only get so far; so I got up and started writing it down. Still waking up, I hadn’t noticed the fairly obvious pattern yet, but some latent high-school maths came back to me and I realised that I was just calculating the sum of C(n,k) for k≥1 (the upper bound is effectively n, since any k>n will yield 0), which quickly gave me my result for n=5: 31.

Having written these sums down for n=1 to n=5 (and having some fun with triangular, tetrahedral and “pentatope” numbers along the way), the pattern was very obvious. But I still made sure to calculate the results for n=6 up to n=9, just to be sure.

And, as expected, n=6 gave 63; n=7: 127; n=8: 255; and n=9: 511.

So I had my answer: in a 3×3 crafting grid, there are 511 possible recipes using any number of an item. But my interest was piqued now and there was no way I could leave it at that.

By this point, my page looked something like this:
table1

I had my formula: for an n-cell crafting grid, there are 2^n – 1 recipes, but I didn’t at all like that “- 1″ bit. How could I get rid of it?

Well, trivially, there was going to be one way to arrange zero of an item in a grid of any size, so I could add a k=0 row with the value of 1 for every n. It was moving away from the original idea, since crafting something from nothing doesn’t really make sense (unlike floating trees and carrying hundreds of cubic metres of rock), but not only did it get rid of the minus one, leaving me with my much-coveted powers of two, it also gave my table a beautiful symmetry.

So I had this table:
table2
And the formula:

60c488e63672e4171c1edd8d684199d8[1]

I wrote “cool!” on my page next to that. I didn’t just say “cool!”, I wrote it down. That’s how cool I thought it was.

And that’s where I ended it, with one big question: why is the nth power of two equal to the sum of C(n,k) for 0≤k≤∞? I don’t know the answer. Maybe no-one knows. More likely, I’m just missing something very obvious to the more mathematically minded.

Whatever the case, I hope you’ve enjoyed reading this post, and if you know the reason for my “cool!” result, please let me know in the comments section.

- Ben xoxo

About these ads

4 thoughts on “Minecraft Maths

  1. Regarding the Cool Equation: each side is counting the same thing (in this case, subsets of a set with n elements) in a different way. (Which, IMO, makes it even more cool.)

    Given a set X of n elements, 2^n is counting the number of subsets of X, while {n \choose k} counts the number of subsets having exactly k elements.

  2. What if k>10? Isn’t that a whole different game? Max is 64×9.Then throw in a max of 9 different items and my brain aches.

  3. Hi, it seems you’ve (re)discovered Pascal’s Triangle, and with it Combinations. Good job getting there yourself. Now find a scientific calculator and do “8C2″ (or plug it into wolfram). You’ll find that you get 28 (i.e. n = 8, k = 2 [Protip: generally what you've called "k" is called "r", but it makes no difference]).

    You can extend this problem “how many ways can I arrange two items in eight slots (8C2)?” to another level “how many ways can I arrange two items in eight slots where the order of those two items matters?” These are Permutations, and it’s not too tough to realise for the example given that you just multiply by two (because the pair can be swapped in any arrangement). But for 5C4, for example, you would get 5 as your answer, whereas 5P4 = 120. I wonder if you can figure out what’s going on here :)

Leave a Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s