He started by looking for a pattern that shows which lights are on or off at the end:
(Here an arrow refers to a switch being flipped.)
All the lights start off being off. (That's a weird sentence!)
off → on
off → on →off
off → on → off → on
off → on → off → on → off
The pattern is that if there are an odd number of flips (arrows), then the light is on!
Now, what does this have to do with the 6?
The neat idea here is that the number of flips is really the number of factors of a number. This makes sense, because each the Xth person is going through, finding multiples of X, and flipping their switches.
The number 6 equals the number of factors of 20. The stuff at the end is a quick explanation of how to find the number of factors of a number. You write
20 = 2² × 5¹
To get factors, we "choose" how many 2's we want in our number, and "choose" how many 5's we want. There are three choices for the number of 2's: zero, one or two 2's. There are two choices for the number of 5's: zero or one 5. So there are 3 × 2 = 6 ways to make a factor of 20.
But we saw that if the number of factors is even, then the light will be off, since the number of off-flips and on-flips will cancel each other out.
So since 20 has an even number of factors (6 factors), its switch will be off!
This is such a cool idea, because it basically liberates you from having to calculate things by hand. Would you rather draw a huge grid and painstakingly figure out all the factors of each number, then coloring in the squares. or would you rather use neat tricks to just find the numbers that have an odd number of factors (basically numbers that have only odd powers of primes in their prime factorizations)? I know I wouldn't!
Please ask if you have any more questions; we love answering them!
Thanks for the question! Here, we are trying to find the number of factors of 20, which we found the prime factorization of as \(2^2 \times 5^1.\) To count the number of factors, we want to count the number of ways that we can choose powers of 2's and 5's, which we multiply together to get our factor.
As in the video, we can pick either 0, 1, or 2 powers of 2, and either 0 or 1 powers of 5, for our factor. This means we have 3, or (2+1), choices for how many 2's we pick, and 2, or (1+1), choices for how many 5's we pick. To get the total number of choices, we simply multiply the two, giving (2+1)*(1+1), as you mentioned.
In fact, no matter what exponent our prime factor has, the number of choices for how many of that prime we can pick will always be the exponent plus 1. This is because we can pick any amount from 1 up to the exponent, or, as Po mentioned in the video, we could also choose to have zero of the prime factor, giving us one extra option each time.
Hopefully this clears things up, and don't hesitate to ask if you have any further questions!