I came across a weird problem today that has really gotten me scratching my head as normally I am pretty good at simple mental maths challenges, however with this one I seem to be completely stumped.
Here goes the context:
There is a donation warehouse that is filled with a 3 different types of fruit that gets emptied and counted every day. The fruits are then divided into 8 boxes and the goal is to try and fill the boxes as much as possible regardless of which fruit type. Different fruits cannot be kept in the same box for more than a day so therefore for the purpose of this problem cannot be mixed. The fruits are Apples (A), Bananas (B) and Cherries (C).
Conditions:
There are 8 boxes and all 8 boxes must be filled with at least something
There is nothing preventing 7 of the boxes being made up of Apples (A) and then only 1 box being Bananas (B) and 0 boxes being Cherries (C) if that ensures the boxes are filled with as much of the total as possible.
All 8 boxes should be evenly filled.
Having left over fruits (a remainder) is acceptable, but obviously not ideal so we want to minimise the remainder.
Fruits cannot be divided so decimals are not to be used.
At the start of the dividing process, we will always know the distribution of Apples (A), Bananas (B) and Cherries (C).
Example of one of the days:
One day we received 800 Apples (800A), 600 Bananas (600B) and 200 Cherries (200C). This meant we had 1600 Fruits (1600F) in total and the distribution of A:B:C was 4:3:1. Therefore the best way to split these into boxes was to have 200 items in each box and to have 4 boxes of Apples (A), 3 boxes of Bananas (B) and 1 box of Cherries (C).
Example of another day:
Another day we received 825 Apples (825A), 600 Bananas (B) and 200 Cherries (C). This meant we had 1625 Fruits (F) in total and the distribution of A:B:C was 33:24:8. Therefore the best way to split these into boxes was to have 200 items in each box still and to have 4 boxes of Apples (A), 3 boxes of Bananas (B) and 1 box of Cherries (C) and to accept there would be 25 Apples (A) left over.
Is there a way of putting this into a formula for me to input the Apples (A), Bananas (B) and Cherries (C)? I have the attached equation that where at any time I am calculating the answer I know what the Total Number of Fruits is, however I am having difficulty figuring out what the values for the remainder will be. Happy to discuss and explain more, but I feel as though the solution may only be iterative.