Hi,

My son is in third grade and came home with a math word problem the other day.

The basic problem said something like

"Ted has $6.00 to spend. How many combinations can he buy if

Ice pops: $.40

Candy: $.25

Toy: $.30

We answered it by trial and error, but I was thinking there must be a way to solve this to find all the possible result sets.

I know how to solve systems of equations but in this case it would only be one equation

40x + 25y + 30z = 600

Any ideas how to solve this for all possible (interger) result sets? My algebra is rusty, it's been a while since I've been in grade school.

I'm working on it myself now in perl, but wanted to see what everyone else came up with.

Nacht

40x + 25y + 30z = 600

but that sounds more like

"Ted has to spend $6.00"

than what you initially described as

"Ted has $6.00 to spend"

Can you clarify the actual requirements?

http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity