# Math optimization riddle

You have been given the task of transporting 3,000 apples 1,000 miles from Appleland to Bananaville. Your truck can carry 1,000 apples at a time. Every time you travel a mile towards Bananaville you must pay a tax of 1 apple but you pay nothing when going in the other direction (towards Appleland). What is highest number of apples you can get to Bananaville

The answer is $$\boxed{833}$$. However, I don't understand how to obtain this answer. Also, is there any way to show that the answer is optimal?

I have seen a riddle similar to this before, and I think the trick is to move $$1000$$ apples towards a stopping point, come back, get more to that stopping point, and so on. I can't figure this one out, though.