# Car Talk puzzler. . .

**URL:** <https://boards.straightdope.com/t/car-talk-puzzler/331157>\
**Category:** Factual Questions\
**Created:** [November 15, 2005, 2:41pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157 "2005-11-15T14:41:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trunk](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Trunk](https://boards.straightdope.com/u/Trunk)\
**Post date:** [November 15, 2005, 2:41pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/1 "2005-11-15T14:41:50Z")

</div>

This is from the Car Talk web page. . .

> [@](#):
>
> RAY: This next puzzler is from my “ceiling light” series.
> 
> Imagine, if you will, that you have a long, long corridor that stretches out as far as the eye can see. In that corridor, attached to the ceiling are lights that are operated with a pull cord.
> 
> There are gazillions of them, as far as the eye can see. Let’s say there are 20,000 lights in a row.
> 
> They’re all off. Somebody comes along and pulls on each of the chains, turning on each one of the lights. Another person comes right behind, and pulls the chain on every second light.
> 
> TOM: Thereby turning off lights 2, 4, 6, 8 and so on.
> 
> RAY: Right. Now, a third person comes along and pulls the cord on every third light. That is, lights number 3, 6, 9, 12, 15, etcetera. Another person comes along and pulls the cord on lights number 4, 8, 12, 16 and so on. Of course, each person is turning on some lights and turning other lights off.
> 
> If there are 20,000 lights, at some point someone is going to come skipping along and pull every 20,000th chain.
> 
> When that happens, some lights will be on, and some will be off. Can you predict which ones will be on?

I’ll take it to mean, “given a number, N, can you tell me if that light will be on or off?” They’re not looking for a proportion or anything like that.

Anyway. . .the easy part: first of all, you know that any prime number will be ON.

Seems to me you need to know the NUMBER of divisors each number has. If that’s ODD (including itself, like 15: 3, 5, 15 or 6: 2,3,6) then the light will be ON. If that’s EVEN (like 16: 2, 4, 8, 16 or 49: 7,49) then the light will be off.

But, I don’t know an easy way to find the number of divisors of a number.

Any thoughts? A simple trick that I’m overlooking?

---

<div class="post-metadata">

**Author:** ![crazyjoe](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@crazyjoe](https://boards.straightdope.com/u/crazyjoe)\
**Post date:** [November 15, 2005, 2:49pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/2 "2005-11-15T14:49:45Z")

</div>

Unless I’m mistaken, at the point at which someone comes along and pulls every 20,000th chain, all the Prime numbers less than 20,000 will be OFF, not ON. Someone turned them all on initially.

For instance, 7 is a prime number. It was originally ON (after dude #1 pulled all the cords), and was turned off when dude #7 came through and pulled every 7th chain.

---

<div class="post-metadata">

**Author:** ![Trunk](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Trunk](https://boards.straightdope.com/u/Trunk)\
**Post date:** [November 15, 2005, 2:57pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/3 "2005-11-15T14:57:32Z")

</div>

> [@crazyjoe](#):
>
> Unless I’m mistaken, at the point at which someone comes along and pulls every 20,000th chain, all the Prime numbers less than 20,000 will be OFF, not ON. Someone turned them all on initially.
> 
> For instance, 7 is a prime number. It was originally ON (after dude #1 pulled all the cords), and was turned off when dude #7 came through and pulled every 7th chain.

yeah, yeah. . .i mis-read. I didn’t consider the first person who came through and just turned every single light on. I was starting with person ‘2’.

All the primes will be off as well as all the numbers with an odd number of factors (not counting 1).

---

<div class="post-metadata">

**Author:** ![zut](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zut/32/2875_2.png) [@zut](https://boards.straightdope.com/u/zut)\
**Post date:** [November 15, 2005, 3:03pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/4 "2005-11-15T15:03:28Z")

</div>

Actually, it’s a bit simpler than you think: All the lights will be off except those lights that are perfect squares. Remember all divisors come in pairs, so each pair (even the 1,N pair) will represent an ON and and OFF. The only exception is the perfect square, which, since the square pair consists of identical numbers, gets an odd number of pulls.

---

<div class="post-metadata">

**Author:** ![Jurph](https://avatars.discourse-cdn.com/v4/letter/j/50afbb/32.png) [@Jurph](https://boards.straightdope.com/u/Jurph)\
**Post date:** [November 15, 2005, 3:09pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/5 "2005-11-15T15:09:30Z")

</div>

Aren’t the only numbers with an odd number of factors the squares? Just off the top of my head, it seems like any other number is going to have pairs of factors:

…  
33 11 3 1 (even)  
34 17 2 1 (even)  
35 7 5 1 (even)  
36 18 9 6 4 2 1 (ODD)  
37 1 (even)  
38 19 2 1 (even)  
39 13 3 1 (even)  
40 20 10 8 5 4 2 1 (even)  
…

Since each factor of a number must be multiplied by another _different_ factor (call them partners), they’re always going to be in pairs except for the special case where the factor is its own partner.

So I posit that  
(1) if all of the bulbs start out OFF  
and  
(2) if the first walk through the hall dispatches the responsibility for the “1” which is every number’s factor

then  
on the Nth switch-flipping, all of the squares lower than N will be ON and every other bulb will be OFF.

---

<div class="post-metadata">

**Author:** ![Trunk](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Trunk](https://boards.straightdope.com/u/Trunk)\
**Post date:** [November 15, 2005, 3:13pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/6 "2005-11-15T15:13:03Z")

</div>

ding.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [November 15, 2005, 9:04pm UTC](https://boards.straightdope.com/t/car-talk-puzzler/331157/7 "2005-11-15T21:04:27Z")

</div>

> [@Jurph](#):
>
> Aren’t the only numbers with an odd number of factors the squares?

Yep, just like **zut** explained it.
