# Cutting the Cheese

In preparation for a banquet dinner, you are carving up a massive cubic block of cheese. The only people who will be eating the cheese are you and six guests invited to the banquet.

Cheese must always be consumed in tiny cubes (so dictate the laws of cheese etiquette). With this in mind, you pick a large number, $n$, and proceed to cut the cheese block into perfect identically-sized cubes by making $n$ cuts widthwise, $n$ cuts heightwise, and $n$ cuts depthwise. You're positive that you've made $n$ large enough that each guest will get several cubes of cheese.

Unfortunately, as luck would have it, you forget $n$ as soon as you've finished.

No problem. You have 30 minutes left until the cheese has to be set out. You decide to count the number of cubes along one edge of the block, and do so. Exactly 15 minutes later, at the moment you've finished counting the last cube along the edge, disaster strikes! The MC rushes into the kitchen to inform you that the guests are feuding, and that if each guest doesn't get exactly the same number of cheese cubes, the dinner will be ruined. If there are any cubes left over, the guests will surely fight over them, which isn't acceptable. Nor is it acceptable for you to eat or discard any left over cubes.

You've misplaced your knife, hence cutting the cheese cubes is out of the question. And the guests are hungry, hence everyone (including you) must get at least one cube of cheese.

To remedy the situation, you're able to count, remove or replace individual cheese cubes from the block. You figure you can remove/replace them as quickly as you counted them earlier, and, if need be, you can count a cube while you remove or replace it.

Along each edge there are... Oh no! Curses! With all the excitement, you've forgotten the number!

Panic sets in.

You have 15 minutes left. Exactly enough time to count, remove, or replace as many cubes as are along one edge of the cheese block. You can finish early, but you can't finish late.

Note the sequence of events:

1. you count, remove, or replace cubes
2. you put the remaining cheese cubes out
3. you take your cheese cubes to eat (there must be at least one)
4. the guests take turns taking cubes, repeating until none are left

What do you do?

(Please note that this is a math problem and not a lateral thinking problem.)

• Not sure if I understand this. The number of cubes along one edge is $n+1$, right? So the total number of cubes is $(n+1)^3$, and you want to end up with a multiple of 7? – Rand al'Thor Jun 9 '15 at 23:27
• I'm unclear about what sorts of strategies are legal - could I, for instance, count every $7^{th}$ cube and then count the remaining cubes (and effectively calculate $n$ mod $7$), and then either do nothing, remove a cube, or replace (?) a cube (or must I remove $6$?) – Milo Brandt Jun 9 '15 at 23:43
• I'm having trouble reconciling "Nor is it acceptable for you to eat or discard any left over cubes." and "everyone (including you) must get at least one cube of cheese." So, you cannot eat any, but you must eat at least one? Also, if you can handle at most $n+1$ cubes in the allotted time, how are you supposed to sort through $(n+1)^3$ cubes? Or do you just have to determine the number to give to each guest, and you elves will divide the pile for you? – 2012rcampion Jun 9 '15 at 23:44
• The block of cheese is large enough that it takes you fifteen minutes to count one edge? How large is your knife and how did you lose it!? – tfitzger Jun 10 '15 at 18:26
• @2012rcampion: I should have specified the sequence of events: 1) you put the cheese out, 2) you take your cheese cubes to eat (there must be at least one), 3) the guests take turns taking cubes, repeating until none are left. I'll clarify this in the problem statement now. – COTO Jun 10 '15 at 19:54

The number of cubes along one edge is $n+1$ (since you made $n$ cuts), so the total number of cubes is $(n+1)^3$. You want to remove some of the cubes along one edge so that the total number of cubes is a multiple of 6 (the number of guests).

If you remove all the cubes along a single edge, the total number remaining is $(n+1)^3-(n+1)=(n+1)(n^2+2n+1-1)=n(n+1)(n+2)$. This number must be a multiple of $2$ (since one of $n$ and $n+1$ must be even) and also of $3$ (since once of $n$, $n+1$, and $n+2$ must be a multiple of $3$), and therefore of $6$. So you should

remove an entire edgeworth of cubes

to satisfy the guests.

• Far as I interpreted the problem, I think it's supposed to be a multiple of $7$ - there are 6 guests + you – Milo Brandt Jun 9 '15 at 23:37
• @Meelo I thought so at first, but since 7 is prime, I don't think there can be any 'interesting' solution for that (beyond something trivial like counting the lot and then taking away a number between 0 and 6). I may be wrong though... – Rand al'Thor Jun 9 '15 at 23:42
• I'm not sure; I thought about trying to, each step, count and remove/replace/do nothing so that no matter where you stop, you'll be fine - but this doesn't quite work, unless you can remove or replace two cubes in a single step. (It is, however, encouraging that the only cubes mod $7$ are $-1$, $0$, and $1$) – Milo Brandt Jun 9 '15 at 23:45
• This is actually the answer I was looking for. Namely: $n^3 - n$ is guaranteed to be a multiple of $6$, hence removing all but one cube from an edge leaves a $6k + 1$ cubes for some integer $k$. Thus every guest gets $k$ cubes, and you get 1. – COTO Jun 10 '15 at 19:47
• @COTO I think the puzzle you wanted got lost in the story – Anon Jun 11 '15 at 13:58

EDIT: To handle the time required for removing cubes, when counting each of the cubes, remove the first 7 (there must be at least 7 if it takes 15 minutes to count). When you get to the last cube, your decision will be to either take it away (1), keep it (0), or add one (6).

Here's a solution assuming everyone (including yourself) needs the same number of cubes:

The list of cubes mod 7 follow a specific pattern (1, 1, 6, 1, 6, 6, 0). When you're counting the edge, instead of counting (1,2,3,4...), count 1, 1, 6, 1, 6 etc. looping every 7 and on the last number, do what that number says. If it's 1, remove 1. If it's 6, remove 6. If it's 0, do nothing.

• But if you count all the cubes along an edge then you don't have any moves/time remaining to remove any more. – 2012rcampion Jun 10 '15 at 0:15
• @2012rcampion I added an edit to address that. – Quark Jun 10 '15 at 0:32
• Excellent answer. It's actually not required that you get the same number of cubes as the guests, only that i) each guest gets the same number of cubes, and ii) everybody, including you, gets at least one cube. A +1 from me, although I've given the check to the simpler, more canonical answer by rand. – COTO Jun 10 '15 at 19:50

Even with the clarifications, this puzzle is pretty easy.

## Trivial Solution #1

If you just count the number of cubes along an edge, you will know how many to take in step 3.

Here is the sequence:

1. Count all $n+1$ cubes along one edge.
2. Put out the entire block.
3. Take a number $k\in\{1\ldots 6\}$ of cubes such that $k\equiv(n+1)^3\mod 6$.
4. The six guests divide the remaining cubes evenly among themselves with none left over (since $(n+1)^3-k\equiv 0\mod 6$).

## Trivial Solution #2 (Dubious)

Count out $7$ cubes, and discard the rest of the block.

Here is the sequence:

1. Count and remove seven cubes (we can assume that $n\ge 6$, so you will be able to count out at least seven).
2. Put out the seven you counted (this is where this solution is dubious, since you're supposed to put out the non-removed cubes).
3. You take exactly one cube.
4. The six guests each take one cube, leaving none left over.

• Simplest answer, +1 – CyanogenCX Jun 10 '15 at 0:04
• From the OP: this is a math problem and not a lateral thinking problem. – Rand al'Thor Jun 10 '15 at 8:58
• @rand How is this lateral thinking? I make no additional assumptions beyond those stated in the problem. – 2012rcampion Jun 10 '15 at 11:01
• It gets a +1 from me. Note that I've added a "sequence of events" that would disqualify this solution, but that's my problem and not yours. ;) – COTO Jun 10 '15 at 19:54
• @COTO My answer was actually meant to goad you into specifying exactly that... I knew it wasn't "correct". (Although the new sequence allows a new 'trivial' answer, which I'll post when I get home.) – 2012rcampion Jun 10 '15 at 20:16

Assuming that the guests need to have the same number of cubes, but you don't (which is consistent with what the question currently says), I would advise the following steps. Start with step $1$ and proceed to step $7$ (one cube at a time), then repeat the whole process.

1. Count a cube, remove a cube.
2. Count a cube.
3. Count a cube, replace one.
4. Count a cube, remove a cube.
5. Count a cube, replace one.
6. Count a cube.
7. Count a cube.

This guarantees, at each step, that the number of cubes will be either $-1$ or $0$ mod $7$ - so either one person will have one less cube, or everyone will have equally many. Thus, if you deal the cheese cubes out to your guests, serving yourself last, you will ensure that every guest has equally many cubes.

Notice that we could equally well express the process as saying that, at step $n$, you need to have, in total, removed $1$ cube if and only if $n^3\equiv 1\pmod 7$. (The other cubes mod $7$ being $0$ and $-1$, we find that we don't need any special handling in those cases)