Find two positive numbers whose sum is 15 and so that the product of one number with the square of the other is a maximum.
(You must prove the product produces a maximum).
That's how most students handled the problem. Without knowing much about calculus you might be forced to try pairs of numbers and make a big list of them to see the answer. That's what one of my students did and eventually got the right pair of numbers out of (1,14), (2,13), (3,12),...., (7,8). I know...pressure of the exam! Maybe the student would have handled it differently on another occasion.
Now in principle, there is no reason why the answers had to be integers. The question could have been couched slightly differently to produce a fractional solution, say, (5.5,9.5). In that case, guessing integers would have produced a misleading conclusion. The calculus method hones in and proves the correct solutions without needing to list a lot of possible solutions.
In fact there is no rational algebraic function which always gives prime numbers.