This question already has an answer here:
Hi here is the question I have in hand:
There are $1000$ empty baskets lined up in a row. A monkey walks by, and puts a banana in each basket, because this is a word problem, and that is what a monkey would do in this situation. There is an unlimited supply of bananas. A second monkey walks by, and removes a banana from every other basket, starting with the second basket. I may not have mentioned there are also $1000$ monkeys. Monkey $\#3$ walks by. Starting with the third basket, and visiting every third basket thereafter, this monkey removes a banana from any basket that contains a banana, and places a banana into any basket that needs one. (Monkeys don't think in terms of, "this basket is empty", they just think "this basket needs a banana".) Anyway, the fourth monkey goes by, doing the same thing to every fourth basket. This continues all afternoon until all $1000$ monkeys have walked by the $1000$ baskets. How many bananas are in baskets?
So, to my understanding this clearly has something to do with prime factorization. My thought process is,
If we take
$$1000 = 2^3 \cdot 5^3,$$
we can obtain using divisor function and multiplication principle
telling us that there are $16$ divisors of $1000$.
My problem is, how do I account for "every fourth basket" and so on? How do I conclude that there are $x$ number of bananas left? A little lost as to how I proceed in this case.