100 盏灯
100 Light bulbs
题目详情
有 100 盏灯初始都关着。第 1 轮:把所有灯的开关切换一次;第 2 轮:每隔 1 盏切换一次(切换第 2,4,6,... 盏);第 3 轮:切换第 3,6,9,... 盏;……第 100 轮:只切换第 100 盏。
问:最后哪些灯是亮着的?
There are 100 Light bulbs in a sequence, all kept in OFF state. The first person comes and toggles all the bulbs which are at position that is multiple of , i.e. switch all bulbs to ON. The second person toggles all multiples of , i.e. turn the even numbered bulbs OFF and leave the odd ones as is. The third person comes and toggles all multiples of . This process continues till the person do their part. After this, how many bulbs are in ON state?
Hint
Consider bulb number 1 and 4, how is its outcome different than the others.
解析
编号为完全平方数的灯会亮着:。
原因:第 盏灯会在所有能整除 的轮次被切换一次,总切换次数等于 的因子个数。只有完全平方数的因子个数为奇数(因为 这一因子成对合并后会“单独剩一个”),因此只有完全平方数最后保持“开”。
Original Explanation
10 bulbs
Solution
Observation
Draw a small grid of 6x6 on a piece of paper and simulate the outcome.
Observe that each bulb is toggled as many times as many unique divisors it has. For example, bulb number 6 has divisors [1,2,3,6], so it is toggled back and forth by person number [1,2,3,6], i.e, 4 times.
In this case, only the bulb number and are ON at the end of 6 steps, and they have odd number of divisors. Can it be that perfect square number have odd unique divisors?
Checking for some more numbers:
- Divisors for are , hence toggles
- Divisors for are , hence toggles
Hence we form a conjecture: For perfect squared numbers, the count of unique factors is always odd.
Proof: Divisors are always found in pairs. For number if we find one divisor then we also just found another divisor . The divisor count would increase by 2, unless which happens exactly once for a perfect square and never for any other number.
Note that for a non-square number, the count of unique divisors are always even.
A bulb at position is toggled between ON / OFF states only by the person whose number is divisor of . When is a perfect square number then the bulb will be ON at the end because of the odd sequence of toggling. For all the other numbers, the bulb will be OFF because of the even sequence of toggling.
Thus bulbs 1,4,9....81,100 are ON, at the end.
Hence 10 bulbs are on.
Generalization
If there are bulbs in a sequence and people, then the number of bulbs that are ON at the end is
Divisor Formula
Let be a positive integer and is the prime factorization of
In how many different ways can we form a divisor?
Let be a divisor of , where .
Thus, there are choices for each prime factor , indepdently for each .
Thus, the total number of divisors of is given by
If is a perfect square, then each is even, so is odd. Therefore, the product is odd.