# im pulling my hair out

October 16, 2006 6:13 PM Subscribe

help me prove this is impossible:
package of goobers has 5 per package
package of marshmallows has 2 per package
package of gum has 1 per package
how can i have 9 packages totalling 13 treats?
i think its impossible. prove me wrong.

Response by poster: i understand it can be done by only using two of the 3 types; im not sure that is an option in the problem. thanks for the sanppy resposnes though.

posted by fumbducker at 6:17 PM on October 16, 2006

posted by fumbducker at 6:17 PM on October 16, 2006

Pulling your hair outOK. Let's assume that you have to have at least 1 of everything. Therefore, you have either 1 or 2 goobers. (3 goobers would make 15 treats, so that is too many.)

Let's say you have 2 goobers. You then have to have 7 more packages to make 9. The smallest package you have, gum, has 1 treat each, so 2 goobers and 7 gums makes 17 treats. That's too many.

So your proposed solution must have exactly 1 package of goobers, because we've ruled out 0, we've ruled out 2, and we've ruled out everything greater than 2.

Ok, so now you have 1 goober. That means 5 treats accounted for. In order to fit the conditions of the problem, you have to use 8 more packages to get 8 more treats. The only way to do that is if it's all gum.

You must cite this post on your homework assignment, or you will be in violation of Federal copyright law. Here is the right way to cite it.

"Pulling your hair out." Ikkyu2, MetaFilter.com, WWW, 2006. URL: http://ask.metafilter.com/mefi/48738, accessed October 16, 2006.

posted by ikkyu2 at 6:25 PM on October 16, 2006 [4 favorites]

Let's say you have 2 goobers. You then have to have 7 more packages to make 9. The smallest package you have, gum, has 1 treat each, so 2 goobers and 7 gums makes 17 treats. That's too many.

So your proposed solution must have exactly 1 package of goobers, because we've ruled out 0, we've ruled out 2, and we've ruled out everything greater than 2.

Ok, so now you have 1 goober. That means 5 treats accounted for. In order to fit the conditions of the problem, you have to use 8 more packages to get 8 more treats. The only way to do that is if it's all gum.

You must cite this post on your homework assignment, or you will be in violation of Federal copyright law. Here is the right way to cite it.

"Pulling your hair out." Ikkyu2, MetaFilter.com, WWW, 2006. URL: http://ask.metafilter.com/mefi/48738, accessed October 16, 2006.

posted by ikkyu2 at 6:25 PM on October 16, 2006 [4 favorites]

Response by poster: nice - im actually posting for my wife, who teaches 4th grade, and assigned her kids a worksheet with this problem, and she couldnt get the answer to work using all 3 types. i told her it was impossible, just wanted reassurance. thanks.

posted by fumbducker at 6:30 PM on October 16, 2006

posted by fumbducker at 6:30 PM on October 16, 2006

ok

1 package of goobers = 5

1 package of marshmellows = 2 ... we're up to 7 so far and 2 packages

6 packages of gum = 6 ... so you have 13 pieces in 8 packages

wait ... i'm supposed to have 9?

your trick or treat bag makes 9

can we say trick question?

posted by pyramid termite at 7:13 PM on October 16, 2006

1 package of goobers = 5

1 package of marshmellows = 2 ... we're up to 7 so far and 2 packages

6 packages of gum = 6 ... so you have 13 pieces in 8 packages

wait ... i'm supposed to have 9?

your trick or treat bag makes 9

can we say trick question?

posted by pyramid termite at 7:13 PM on October 16, 2006

Yes, it's impossible. Think of it this way: you have to use all three candies, so immediately you're down to needing the gum and the marshies to add up to 8 candies and 8 packages (because you can never get the answer by using more than one pack of goobers), which is impossible because as soon as you use 1 pack of gum you're down to needing 6 candies and 7 packages, which is impossible.

Also, screw the candies. Invest in some punctuation. Reading your Q gave me a headache. ;)

posted by dobbs at 7:40 PM on October 16, 2006

Also, screw the candies. Invest in some punctuation. Reading your Q gave me a headache. ;)

posted by dobbs at 7:40 PM on October 16, 2006

Eponysterical.

posted by CunningLinguist at 8:01 PM on October 16, 2006 [1 favorite]

posted by CunningLinguist at 8:01 PM on October 16, 2006 [1 favorite]

*Can someone parse this for me?*

OK I am dum and have not algebraed in, uh, a decade. but I think it goes like this:

g = package of goobers

m = package of marshmallows

u = package of gum

g(5) + m(2) + u(1) = 13

g + m + u = 9

which has some solutions if g,m,u ≥ 0

as mentioned above

and is not solvable if g,m,u > 0

as mentioned above

posted by carsonb at 8:25 PM on October 16, 2006

Let SQL do this for you (that is, complete brute force):

create table treats ( id int, name varchar(12), c int ) ;

insert into treats values ( 1, 'goobers', 5 ) ;

insert into treats values ( 2, 'marshmallows', 2 ) ;

insert into treats values ( 3, 'gum', 1 ) ;

select

a.name, b.name, c.name, d.name, e.name,

f.name, g.name, h.name, i.name

from

treats a, treats b, treats c, treats d, treats e,

treats f, treats g, treats h, treats i

where a.id <= b.id and b.id <= c.id and c.id <= d.id and d.id <= e.id

and e.id <= f.id and f.id <= g.id and g.id <= h.id and h.id <= i.id

and a.c + b.c + c.c + d.c + e.c

+ f.c + g.c + h.c + i.c = 13 ;

2 results:

marshmallows, marshmallows, marshmallows, marshmallows, gum, gum, gum, gum, gum

or

goobers, gum, gum, gum, gum, gum, gum, gum, gum

So, only two answers, neither of which uses all three types of treats.

So, ikkyu2 and maxwelton had it. No other answers.

posted by orthogonality at 8:34 PM on October 16, 2006 [4 favorites]

create table treats ( id int, name varchar(12), c int ) ;

insert into treats values ( 1, 'goobers', 5 ) ;

insert into treats values ( 2, 'marshmallows', 2 ) ;

insert into treats values ( 3, 'gum', 1 ) ;

select

a.name, b.name, c.name, d.name, e.name,

f.name, g.name, h.name, i.name

from

treats a, treats b, treats c, treats d, treats e,

treats f, treats g, treats h, treats i

where a.id <= b.id and b.id <= c.id and c.id <= d.id and d.id <= e.id

and e.id <= f.id and f.id <= g.id and g.id <= h.id and h.id <= i.id

and a.c + b.c + c.c + d.c + e.c

+ f.c + g.c + h.c + i.c = 13 ;

2 results:

marshmallows, marshmallows, marshmallows, marshmallows, gum, gum, gum, gum, gum

or

goobers, gum, gum, gum, gum, gum, gum, gum, gum

So, only two answers, neither of which uses all three types of treats.

So, ikkyu2 and maxwelton had it. No other answers.

posted by orthogonality at 8:34 PM on October 16, 2006 [4 favorites]

*assigned her kids a worksheet with this problem, and she couldnt get the answer to work using all 3 types.*

Sounds like a great teacher!

posted by dhammond at 9:52 PM on October 16, 2006

orthogonality, you rock. From now on, Postgres is my calculator.

posted by Deathalicious at 11:16 PM on October 16, 2006

posted by Deathalicious at 11:16 PM on October 16, 2006

As a cute demo, here's how to get a solution to the original problem as originally stated, using the GNU Linear Programming Toolkit:

var goobers integer;

var marshmallows integer;

var gum integer;

maximize z: 0;

s.t. num_bags: marshmallows + goobers + gum == 9;

s.t. num_items: 5 * goobers + 2 * marshmallows + gum == 13;

end;

posted by lunchbox at 11:17 PM on October 16, 2006

var goobers integer;

var marshmallows integer;

var gum integer;

maximize z: 0;

s.t. num_bags: marshmallows + goobers + gum == 9;

s.t. num_items: 5 * goobers + 2 * marshmallows + gum == 13;

end;

posted by lunchbox at 11:17 PM on October 16, 2006

People seem to be overlooking the obvious: fractional packages and fractional treats.

1/5 of a goobers package

+ 3 1/5 marshmallow packages

+ 5 3/5 of gum packages

will produce a total of 9 packages and 13 treats.

posted by vacapinta at 11:53 PM on October 16, 2006

1/5 of a goobers package

+ 3 1/5 marshmallow packages

+ 5 3/5 of gum packages

will produce a total of 9 packages and 13 treats.

posted by vacapinta at 11:53 PM on October 16, 2006

**fumbducker**:

*"my wife, who teaches 4th grade, ...assigned her kids a worksheet with this problem, and she couldnt get the answer to work using all 3 types."*

**dhammond**:

*"Sounds like a great teacher!"*

Well, she is, because there

*is*no answer using all three types. The only two acceptable answers (since we don't allow partial packages or negative packages made out of antimatter) are "1 goober, 8 gum" and "4 marshmallows, 8 gum". There are no answers using all three, so she is at least a good enough teacher to have arrived at that answer.

Carsonb touched on the algebra, but here it is more explicitly:

X = packages of goobers

Y = packages of marshmallows

Z = packages of gum.

We get two formulas:

5x + 2y + 1z = 13

(that is, 5 goobers per pack of goober, plus 2 marshmallows per pack of marshmallows, plus 1 stick of gum per package of gum, totals up to 13 treats)

And

x + y + z = 9

(that is, the number of packages of goobers, marshmallows, and gum, adds up to 9)

I'm going to write this out like my teachers used to:

With the first formula:

5x + 2y + z = 13

Subtract 5x from both sides of the equation:

2y + z = 13 - 5x

Now subtract 2y from both sides:

z = 13 - 5x - 2y

Now that you've isolated z, you can substitute it into the second equation:

x + y + z = 9

Resulting in:

x + y + 13 - 5x - 2y = 9

Reduce, and you get

-4x - y = -4

Multiply both sides by -1 to get things more manageable:

4x + y = 4

Now there are two ways to get at it: You can brute force it easily.

If x = negative, this makes no sense, so don't try it.

If x = 0, then y = 4

If x = 1, then y = 0

If x = 2, then y becomes negative, which makes no sense, so you can stop brute forcing.

So we have two possibilities:

x = 0, or x = 1

If x = 1, then:

y = 0

and z = 13 - 5x - 2y, so

z = 13 - 5 - 0

or

z = 8

If x = 0, then

y = 4

and z = 13 - 5x - 2y, so

z = 13 - 0 - 8

z = 5

So our two answers are:

x = 1, y = 0, z = 8

x = 0, y = 4, z = 5

And that's it.

Now, without brute forcing, you'd need to find intercepts, which I don't feel like transcribing, and is way above 4th grade level.

posted by Bugbread at 6:43 AM on October 17, 2006 [1 favorite]

bugbread, I sort of did what you did except I just took two formulas:

5x + 2y + z = 13

x + y + z = 9

and then subtracted formula 2 from formula 1 to immediately get:

4x+y=4

And I did that in my head...but thats neither here nor there... :)

posted by vacapinta at 10:46 AM on October 17, 2006

5x + 2y + z = 13

x + y + z = 9

and then subtracted formula 2 from formula 1 to immediately get:

4x+y=4

And I did that in my head...but thats neither here nor there... :)

posted by vacapinta at 10:46 AM on October 17, 2006

Best answer: There's a simpler way to show that there are no solutions with at least one of each type.

Assume there is a solution with at least one of each type. Now remove 1 package of goobers, 1 package of marshmallows, and 1 package of gum from that solution.

What's left? 6 packages with 5 treats, which is clearly impossible.

posted by DevilsAdvocate at 1:27 PM on October 17, 2006 [1 favorite]

Assume there is a solution with at least one of each type. Now remove 1 package of goobers, 1 package of marshmallows, and 1 package of gum from that solution.

What's left? 6 packages with 5 treats, which is clearly impossible.

posted by DevilsAdvocate at 1:27 PM on October 17, 2006 [1 favorite]

DevilsAdvocate clearly deserves best answer.

posted by Bugbread at 3:26 PM on October 17, 2006 [1 favorite]

posted by Bugbread at 3:26 PM on October 17, 2006 [1 favorite]

This thread is closed to new comments.

posted by ikkyu2 at 6:15 PM on October 16, 2006