A Hundred Bulbs, 482 Flips, and Ten Survivors
Person k flips every bulb that is a multiple of k, and after a hundred passes exactly the ten perfect squares are lit. Bulb n is flipped once per divisor, and the pairing d against n/d is fixed-point free unless n is a square, so the parity is decided by algebra rather than by accumulation. The lit fraction is one over the square root of the row, and stopping the process at person 50 inverts the answer to 54 bulbs.
A hundred light bulbs stand in a row, numbered to , all switched off. A hundred people walk the row in turn. Person flips every bulb. Person flips bulbs . In general person flips every bulb whose number is a multiple of . After person has finished, which bulbs are on?
Ten of them: . The perfect squares, and nothing else. People asked this for the first time usually expect a scatter with no pattern, or something near half the row, and the actual answer is both sparser and far more structured than either guess. A total of flips happen, and they cancel almost perfectly.
Count the flips, not the bulbs
Person touches bulb exactly when divides . Nobody else touches it. So the number of times bulb is flipped is the number of positive divisors of , written . Bulb is flipped by persons , so .
This is also why stopping at person loses nothing. Every divisor of a number at most is itself at most , so no later person would have anything left to do.
The bulb starts off and every touch changes its state, so the state at the end is decided by the parity of the flip count alone. Bulb is on at the end if and only if is odd. The problem has now been converted from a process into a question about a number, and the process can be forgotten.
Divisors come in pairs, with one exception
Divisors are not scattered at random through the range. If divides then so does , and the map sends the divisors of to themselves and is its own inverse. Applying it twice gets you back where you started, which makes it an involution on a finite set. An involution splits that set into two-element orbits together with its fixed points, so
A fixed point is a divisor with , that is . There is at most one such positive , and it exists exactly when is a perfect square. Everything else pairs off and contributes an even amount.
A positive integer has an odd number of divisors if and only if it is a perfect square. The pairing is fixed-point free unless , in which case its single fixed point is .
Combining the two steps: bulb ends up on exactly when is a perfect square. Between and the squares are the ten numbers through .
The same result through the prime factorisation
The pairing argument is the one to give under time pressure, but it is worth seeing the result fall out of the structure of as well, because that version generalises where the pairing does not. If then a divisor is built by choosing each exponent independently, so
A product of integers is odd exactly when every factor is odd, so is odd exactly when every is odd, which means every is even, which means is a square. Take : the count is , odd, so bulb is lit. Take : the count is , even, so bulb is dark.
Two arguments that share no step and agree on all hundred bulbs. I trust the answer more for having both.
The half-the-row guess gets worse as the row gets longer
The reflex answer deserves a fair hearing. Roughly flips are spread over a hundred bulbs, so the average bulb is flipped nearly five times, and a coin flipped nearly five times has no strong preference. If parities behaved like independent coin tosses, half the row would be lit. They do not behave that way at all, and the reason is that the parity is pinned by an algebraic accident rather than accumulated at random.
The number of survivors in a row of bulbs is the number of squares up to , which is
At that is , a tenth of the row. At it is a thousand, one bulb in a thousand. The lit fraction is and it goes to zero, so the guess "about half" is not off by a constant. It gets worse the longer the row.
The process needs all hundred people
A tempting economy is to think that the late people, who touch only one or two bulbs each, cannot matter much. They matter completely. Stop after person and the row leaves bulbs lit, more than five times the true answer, and the pattern inverts. For any above the second largest divisor is at most , so the only divisor missing from a truncated run is itself. The flip count becomes , which is odd exactly when is even, so every non-square above is left glowing and the three squares are the ones switched off.
This is the kind of detail I would want a candidate to volunteer. The clean answer depends on the process running long enough that each bulb sees all of its divisors, and the problem is set up so that it just barely does.
Sources and further reading
- The function and its multiplicativity — Divisor function
- The set that survives — Square number
- Why (3) counts divisors — Fundamental theorem of arithmetic
- The structure behind equation (1) — Involution
The answer was checked by actually switching a hundred bulbs a hundred times, holding a list of booleans and assuming nothing about divisors, and the resulting set matched (2) exactly. On top of that, the flip count was confirmed equal to for every bulb, the pairing was verified to be an involution with a fixed point exactly at the squares for every up to , and the theorem above was pushed out to , well past where a coincidence on a hundred-wide grid could survive. The count in (4) was compared against a direct count of squares for every up to .
Comments · 0
Be the first to comment.