109k views
2 votes
There are 1000 windows in a mansion with 1000 butlers. The problem begins with the first buyer opening all 1000 windows, next the second butler closes windows 2,4,6,8,10 and so on to window 1000. The third butler changes the states(opened windows are closed,closed windows are open) on windows 3,6,9,12,15 and so on to the fourth butler who changes the state of doors 4,8,12,16 and so on. This goes on until every butler has had a turn. How many and which windows will be opened at the end?

User Bassfader
by
8.3k points

1 Answer

5 votes

Final answer:

After all 1000 butlers have gone, only the windows at positions that are perfect squares will remain open, which are 31 windows in total: 1^2, 2^2, 3^2, ..., 31^2.

Step-by-step explanation:

The question involves a challenging puzzle, commonly referred to as the 1000 butlers problem, which is based on a mathematical concept dealing with factors of numbers. To determine which windows remain open, you need to realize that each window will be toggled (opened or closed) the number of times that corresponds to the number of its factors. A window will end up open only if it's toggled an odd number of times, which occurs only for numbers that are perfect squares since they have an odd number of factors. This is because the factors of a perfect square number always include a duplicated factor (the square root), unlike other numbers which have factors in pairs.

So, we are looking for the perfect squares between 1 and 1000. Those would be the square of 1, the square of 2, and so on, up to the square of 31, because 32 squared is 1024, which is beyond our range. Hence, there are 31 windows that will remain open: 1, 4, 9, 16, 25, ..., up to 961, which is the square of 31.

User Masebase
by
8.6k points