For a final, we were asked to write a program that would find positive integer solutions of the equation x^4 + y^4 + z^4 = kxyz where k is a constant. Solutions were (helpfully) limited to the integers between 1 and 1000. Even so, the brute force solution runs quite slowly, so we were asked to find a way to speed it up. My solution was to apply the constraint 1 =< x =< y =< z =< 1000, which worked well enough, but I did notice that when k is even, either all the variables must be even, or two must be odd. I couldn't think of a way to implement this that wouldn't just be wasteful.
Anyone have any ideas on how to make this work? Or is there a better way?