As instructed by Great Teacher Gareth, let's put the fruit on sale, and lower each price by a dollar:
- Jackfruits, now only 14 dollars each!
- Papayas FOR FREE!
- Get 71 cents with every free Banana!
- Take our Strawberries, and we'll give you 87 cents!
and then we'll try to
spend exactly zero dollars. We instantly notice how this makes the number of papayas irrelevant, so we'll just have to figure out the rest, and then "fill up to 100" with papayas.
We'll want to figure out a
prime numbered combination of strawberries and bananas that ends up at either -28, -42, or -70 dollars, because those are the possible costs of jackfruit that we need to offset.
Let's use trial and error, which is now easy, since we have a definite target:
Start with the largest prime number of bananas that fits inside the target price, and 2 strawberries. If the sum is too high, lower the number of bananas, and if it's too low, add strawberries, always skipping any non-prime values. This process makes quick work of the checking process, while making sure you won't miss any solutions. (I used a calculator for this, which may be against the spirit of the no-computers tag, though.)
By doing so, we get that
* We cannot get to -28 at all
* We cannot get to -42 at all
* The only way to get to -70 is to get 41 bananas and 47 strawberries
That seems nice, and the numbers are smaller than a 100, so all that remains to be done is to check the number of papayas for primality.
Adding up the other numbers, we know that there must be 7 papayas.
Yay, it IS prime, and it's different from the other numbers, so we have a solution!
* 5 Jackfruits
* 7 Papayas
* 41 Bananas
* 47 Strawberries