in reply to CarTalk Puzzler

Each number is accessed as many times as it has distinct factors including itself. If the total number of such factors is greater than 1, then the number of factors is even because the total permutations of the set of prime factors of a number is 2^N where N is the number of such factors (N is only 0 if there are no such factors which only occurs for 1), creating at first sight a general rule for turning all lights off except the first one. But there are exceptions to that rule occurring where the difference between the raw number of permutations and the number of elements of the uniquified version of that set is odd (because repeating factors only actually access the light once). And that only occurs where the unique factorisation into primes contains an even number of occurrences of each prime. The two propositions: "x is a perfect square" and "the unique factorisation of x into primes can be divided into two equal sets" imply each other.

-M

Free your mind