Matt Enlow (math teacher in MA) posted a fascinating problem online today, one he thinks of when storing all those plastic bags from the grocery store. You shove them so they all lie in a single bag, and throw that bag under the sink. Here’s the question: how many different ways can you store these bags?

For 1 bag, there is only 1 way.

For 2 bags, there is still only 1 way.

For 3 bags, there are 2 ways.

Here is a picture for clarification:

Can you figure out how many ways for 6 bags? 13 bags?

You are now officially nerdsniped.

A number of people had trouble calculating 4 bags correctly, so I’ll post the number of ways 4 bags could be stored after the jump at the bottom, so you can at least see if you’re starting off correctly…

**Additional Information:** Matt and I figured the solution to this problem together on twitter. It was an interesting thing. We didn’t really “collaborate,” but we both refined some of our initial data (for 5 bags, he undercounted, and I overcounted). It seemed we were both thinking of similar things — one idea in particular which I’m not going to mention, which was the key for our solution. What blew my mind was that at the exact time Matt was tweeting me his approach that he thought led to the solution, I looked at my paper and I had the exact same thing (written down in a slightly different way). I sent him a picture of my paper and he sent me a picture of his paper, and I literally laughed out loud. We both calculated how many arrangements for 6 bags, and got the same answer. Huzzah! I will say I am fairly confident in our solution, based on some additional internet research I did after.

Obviously I’m being purposefully vague so I don’t give anything away. But have fun being nerdsniped!

**Update late in the evening: **It might just be Matt and my solution is wrong. In fact, I’m now more and more convinced it is. Our method works for 1, 2, 3, 4, 5, and 6 bags, but may break down at 7. It’s like this problem — deceptive! I’m fairly convinced our solution is *not* right, based on more things I’ve seen on the internet. But it is kinda exciting and depressing at the same time. Is there an error? Can we fix the error, if there is? WHAT WILL HAPPEN?!

The number of ways 4 bags can be stored is… (after the jump)