[math-fun] Locker puzzle
Puzzle: ------- Suppose there is a school with an infinity of lockers, numbered 1, 2, 3, .... Initially all lockers are closed. Definition: A locker is "switched" if it is changed from shut to open, or vice versa. At 1/2 minute to noon, every 2nd locker 2, 4, 6, ... is switched. at 1/3 minute to noon, every 3rd locker 3, 6, 9, ... is switched. Or in general: For each positive integer n >= 2: * At 1/n of a minute to noon, every nth locker n, 2n, 3n, ... is switched. No other changes are made to the lockers. Question: --------- Which lockers are open at noon? —Dan
Which lockers are open at noon?
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The lockers that are open should be the ones where the number of divisors of their locker number less one (because we don't switch for divisibility by 1) is odd. Equivalently, the lockers that are closed are the ones where the number of divisors of their locker number is odd. DivisorSigma[0,Range[25]] {1,2,2,3,2,4,2,4,3,4,2,6,2,4,4,5,2,6,2,6,4,4,2,8,3} Seemingly, an odd number of divisors happens for squares. This must be so because in non-squares, for every divisor greater than the square-root there is a complement smaller than the square-root. But in squares the square-root is its own complement.
participants (2)
-
Dan Asimov -
Hans Havermann