There is a wall with 1000 closed lockers on it. A person walks down the hall opening every other locker. Then the next person opens every 3rd locker. The next opens every fourth locker. The next every fifth locker.
Once this has been done, how many lockers are still closed?
Also, for x lockers, the number of closed lockers is:
xint(x/2)int(x/3)int(x/5)+int(x/6)+int(x/15)+int(x/10)int(x/30)
I ignored the every 4th locker since no lockers were opened.
The "+" terms add back the lockers counted twice that shouldn't have been. Every 30th locker got added 3 times AND subtracted 3 times, so we have to subtract every 30th locker once more, accounting for the last term.
Works out to 266.
As x gets larger the fraction of closed lockers approaches 4/15 of the total number.

Posted by Larry
on 20050613 02:49:18 