red and green apples

1.8k Views Asked by At

We can eat 3 apples per hour.

We must eat:

3 green apples once per 2 hours.
4 red apples once per 3 hours.


We can't eat fractions of an apple. The apples are named, the 3 green (A, B, C) and the 4 red (G, H, J, K). Is it possible to eat the same green apple once per 2 hours and the same red apple once per 3 hours?

Assume, once an apple is eaten, we are given exactly the same one.


My attempt (proving it's impossible):

hour 1: eat 3 green (A, B, C)
hour 2: eat 3 red (G, H, J)
hour 3: eat 3 green (A, B, C)
hour 4: eat 1 red (K)

hour 5: eat 3 green (A, B, C)
hour 6: eat 3 red (G, H, J)
hour 7: eat 3 green (A, B, C)
hour 8: eat 1 red (K)

My other attempt (proving it's possible):

Given the numbers above, we can say:

3 green apples per 2 hours = 3/2 green apple per hour
4 green apples per 3 hours = 4/3 red apple per hour
so 3/2+4/3 apples per hour = 2.83 < 3, proving it's possible


Solution:

https://codegolf.stackexchange.com/questions/16612/apples-many-apples-green-and-red

3

There are 3 best solutions below

5
On

NOTE: this answer is for the original version of the question, in which there was an unlimited supply of apples of both colors, one does not need to eat the same apple twice, apples of the same color are indistinguishable, and the goal was to eat at least 3 green apples every two hours and at least 4 red apples every three hours.

There is a very simple solution, involving eating only entire apples, not fractions of apples.

Hint: you do the exact same thing on every odd-numbered hour. You do the exact same thing (not the same as what you do on odd hours) every even-numbered hour.

It's impossible to eat exactly the number of apples requested given all the constraints, without eating fractional apples. I proved it by contradiction. It required several cases, and it wasn't interesting enough that I feel compelled to write all the details. I'll leave it to you, if you need to do this.

Regarding your second attempt: using the fractions shows that it is reasonable that there might be a solution. If the fractions had added up to more than three, then it would definitely be impossible.

Your first attempt doesn't really seem to prove anything. It just shows that one particular schedule of apple-eating fails. You don't even need to look past Hour 3, since only 3 red apples were eaten in the first three hours.

If you believe me that it is impossible to eat exactly the number of apples requested (or prove it for yourself), then clearly there is no reason to ever eat fewer than 3 apples in any hour.

0
On

Unless I'm misunderstanding the question, the answer seems simple: alternately eat red and green apples. In any two-hour period, you'll eat a total of $6$ apples, and half of them -- i.e., $3$ -- will be green; in any three-hour period, you'll eat a total of $9$ apples, and either $4$ or $5$ of them will be red.

0
On

It cannot be done. If you eat apples AB and C in the hours 1 and 2, then you will eat apples AB in the hours 3 and 5. It follows that you can eat at most one red apple in hours 1, 3, and 5. Since the number of red apples in the hours 2 and 5 has to be the same, you can eat at most one red apple in hour 2 as well.

Similarly, if you eat apples C and AB in the hours 1 and 2.