10
$\begingroup$

You and your friend Roger are in charge of a soda packaging line. The sodas arrive on a pallet that is shaped like a cube. The two of you must take sodas from the pallet and fill four-pack holders (these are fancy sodas!).

Since the two of your are in complete control of the operation, you may request a pallet of any size, as long as the pallet is still a cube (e.g. 3 sodas wide, 3 sodas long, 3 sodas high). You and Roger are also clever though, and you would like something to drink when you are done packing the pallet.

The Question: What size pallet should you request so that, when you and Roger are finished packing the sodas from the pallet, you have exactly one soda a piece leftover to drink for yourselves?

$\endgroup$
  • 2
    $\begingroup$ As for the "word-problem" comment, I was just following the tag -- "A puzzle that's stated in words, usually in terms of a story or a situation that dresses the problem up". $\endgroup$ – trh178 Apr 13 '15 at 18:43
  • 7
    $\begingroup$ 1. Request a 1-by-1-by-1 pallet 2. Drink all of the sodas :) $\endgroup$ – Lopsy Apr 13 '15 at 18:46
  • 3
    $\begingroup$ @Lopsy, that's only one soda, though. Your friend will be left out. :( $\endgroup$ – Ian MacDonald Apr 13 '15 at 18:57
  • 4
    $\begingroup$ @DJMcMayhem holy crap I just found my new favourite website. $\endgroup$ – Ian MacDonald Apr 14 '15 at 15:02
  • 2
    $\begingroup$ This seems like a rather straightforward math problem, as confirmed by the solution. Also, the question is worded without allowing for the possibility of no value working. $\endgroup$ – xnor Apr 14 '15 at 20:50

10 Answers 10

15
$\begingroup$

Let's say $N$ is the length of the side of the cube. After their operation, you and Roger drink 2 sodas, but you still need a number of bottles which is multiple of 4, otherwise it wouldn't fit the 4-bottles packs.

$N^3-2=4k$ where $k$ is a positive integer.

There's no valid value for $N$!

In fact, $N^3$ $mod(4)$ cycle through {1,0,3,0} (proof below), which is {3,2,1,2} after subtracting 2. As you can see, there's no 0, so no multiple of 4.

Proof: All numbers can be written as $a,(a+1),(a+2)$ or $(a+3)$ where $a$ is a multiple of 4. Respectively, those numbers are congruent to $0,1,2,3$ modulus 4. When you raise to 3rd power, they respectively become congruent to $0^3$,$1^3$,$2^3$,$3^3$, which is $0,1,8,27$, equivalent to $0,1,0,3$ modulus 4.

$\endgroup$
38
$\begingroup$

You and Roger are out of luck. Let the side length of the cube be $s$, so there are $s^3$ sodas. If $s$ is odd, then there will be an odd number of sodas left over, since $s^3$ is odd, and removing 4 from an odd number leaves an odd number. If $s$ is even, so that $s=2t$ for some $t$, then there will be $8t^3$ sodas, which is exactly divisible by $4$, so there are no sodas left over.

$\endgroup$
  • $\begingroup$ If they were really clever, they could just split the last one. $\endgroup$ – Zibbobz Apr 14 '15 at 20:34
  • 1
    $\begingroup$ @Zibbobz Or they could just take the pallet that results in a remainder of three and then split the last one through rock-paper-scissors :P $\endgroup$ – Allan Apr 14 '15 at 21:13
8
$\begingroup$

You could both split up and unpack your own 5x5x5 pallets to have 1 soda each.

To elaborate:

You have a pallet of 125 on one side of the line, roger has another pallet of 125 on the other side of the line. For each four-pack holder that comes down the line, you each put 2 sodas in. After 62 four-pack holders, you both drink the remaining soda from your pallet, grab another pallet each and start again.

Edit:

This works with any odd number, but I chose 5 rather than 1 or 3 as although they have full control over their line, 248 packed for every 2 drank seems better for their productivity or targets :D

$\endgroup$
  • $\begingroup$ 5*5*5=125 Remove 2 bottles, you have 123 remaining. No way to put 123 bottles in 4-pack containers.... $\endgroup$ – leoll2 Apr 13 '15 at 19:03
  • $\begingroup$ No, I am working on a pallet of 125, he is working on his own pallet of 125. That makes 248 out of 250 packed. When we are both done packing, we have 1 each $\endgroup$ – Andrew Smith Apr 13 '15 at 19:04
  • $\begingroup$ "you may request a pallet of any size" A pallet means one pallet! $\endgroup$ – leoll2 Apr 13 '15 at 19:06
  • 4
    $\begingroup$ It also says they are clever $\endgroup$ – Andrew Smith Apr 13 '15 at 19:06
  • 4
    $\begingroup$ I read it more that they could request one size of pallet rather than one pallet $\endgroup$ – Andrew Smith Apr 13 '15 at 19:09
6
$\begingroup$

Here's a short and sweet way of looking at it.

In order to satisfy the restrictions given in the question, you need to find

a number of sodas that is a cube, and that divides by 2 but not by 4.

However,

Any number that does not have 2 as a prime factor will not divide by 2 when cubed. And any number that does have 2 as a prime factor will divide by 8 (and hence 4) when cubed.

Therefore

There is no such number.

$\endgroup$
  • $\begingroup$ I like this much better as the intuitive answer than the rigorous proof. Thanks! $\endgroup$ – Adam Davis Apr 15 '15 at 12:53
5
$\begingroup$

There is no solution

You and your friend will go thirsty, it seems.

There is no number integer such $x$ such that $2=x\mod4$

From the example table below, you can see that it cycles through 1, 0, 3, 0

x   x^3     x^3 mod 4
1   1       1
2   8       0
3   27      3
4   64      0
5   125     1
6   216     0
7   343     3
8   512     0
9   729     1
10  1000    0
11  1331    3
12  1728    0
13  2197    1
14  2744    0
15  3375    3
16  4096    0
17  4913    1
18  5832    0
19  6859    3
20  8000    0
$\endgroup$
3
$\begingroup$

As noted in other answers the problem is looking for a pallet size such that, if $n$ is the number of sodas on a side then $n^3 mod\; 4 = 2$. Another way of stating this is that you want a number $n$ s.t. $n^3 = 4k + 2$ for some integer k.

  • $(4k)^3 = 64k = 4m + 0$ No sodas for you.
  • $(4k + 1)^3 = 64k^3 + 12k^2 + 12k + 1 = 4(16k^3 + 3k^2 + 3k) + 1 = 4m + 1$
  • $(4k + 2)^3 = 64k^3 + 24k^2 + 24k + 8 = 4(16k^3 + 6k^2 + 6k + 2) = 4m + 0$
  • $(4k + 3)^3 = 64k^3 + 36k^2 + 36k + 27 = 4(16k^3 + 9k^2 +9k + 6) + 3 = 4m + 3$

So you can't have exactly 2 sodas left over.

$\endgroup$
3
$\begingroup$

Why assume integers? This is a classic packing problem. Roger and I are extremely lazy and we decide that only two cans should fit in the pallet at all. After all, we want to have plenty of time to drink our sodas.

We figure there is some value between 1 wide and 2 wide which would only allow for 2 cans to fit. We're also too untrained to figure out how to solve this problem properly in 3D (like me), and can't find two cans the same size in the break room, so we pretend this is a 2D problem and easily figure out how to cram 2 circles in a square.

We also figure that if there is a specific solution, then it should work for a can that is exactly as tall as it is wide, which would sure make their math a bit easier. Otherwise, we're going to fuss at the OP in management.

So back to the circles. If we cram them diagonally, then they fit nicely in a pallet $(2+\sqrt{2})/2$ or about 1.7 cans tall/wide/across. We were bright enough to figure this out on our own, but too lazy to make a picture, so Roger cribbed one from this guy's web site, who also shows similar work on determining this solution for his problem.

circles in square

We figure that 3D will give the cans some additional wiggle room not present in 2D -- maybe too much -- so we guestimate that we should probably request it down to 1.6 or 1.5 until the guys in pallet packing start screaming about it.

$\endgroup$
  • $\begingroup$ FYI, Roger and I also whipped out our Excel and figured that there was no neat grid-stacking way to do this, unless we share a couple with the guys in packing (heck no!) or unless I sneak the 1 leftover when Roger isn't looking. Being as he's my ride home, I had better treat him proper. $\endgroup$ – GuitarPicker Apr 14 '15 at 6:22
3
$\begingroup$

It's not possible.

Here's why:

Let's do some basic logic. Say that we have an odd number of sodas per side (for this example, we'll use 5, though it's totally arbitrary). This yields an amount of soda equal to 5 * 5 * 5, or ODD * ODD * ODD. Since we know that ODD * ODD will always equal ODD, we can deduce that the answer here will be an ODD number. An ODD number divided by an EVEN number (4, the number of sodas per container) will always have a remainder in the subset of (2*n - 1), where n a number from 1 to the number of times 2 divides into that EVEN number. The "minus one" in that expression means that the remainder can never be an even number; therefore, the remainder here will never be two.

So

it must be an even number, then! Well, not exactly. The problem with that is that all even numbers can be derived to (2*n). For instance, let's take 10. Our amount of sodas is 10 * 10 * 10, which can be derived to (2 * 5) * (2 * 5) * (2 * 5). Since multiplication doesn't care where the values are placed, we can move these values around to get (2 * 2) * (5 * 5 * 2 * 5). See the problem here? (2 * 2) equals four, and therefore all even numbers will result in a remainder of 0, since they will all be evenly divisible by four.

There we have it, then -

the possible remainders of soda bottles for any number are 0, 1, and 3. There is no possible size of pallet that will yield a remainder of two bottles. Looks like you're just going to have to go thirsty, or bend the rules a bit...

EDIT: Looks like I've been beaten to the punch! Glad to see I came up with the right answer, anyways.

$\endgroup$
2
$\begingroup$

You are out of luck.

There are 2 observations you can make:

1: An odd number to the power 3 will always be odd. And if you're packiging it in four-pack holders, you're subtracting an even from an odd number so there will always be an odd number of cans left.

2: Each even number (n) to the power 3 can be rewriten as: 2^3 * (n/2)^3 so each even number will be divisible by 8, which means it fits exactly in 4-pack holders without any cans left.

$\endgroup$
-2
$\begingroup$

I'm no math wonder or something but if you have a pallet of 789*789*789 = 491.168.069 bottles (. for easier reading) and then first take 2 away = 491.168.067 and then divide it by 4 for the 4-pack.. you are left with 122.792.267 4-packs?

just some random thinking and number punching on my phone's calc.

Also I first picked off 2 soda bottles.. not at the end.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.