Introducing the LemonFools Personal Finance Calculators
The Long Tunnel

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
The Long Tunnel
There is a long, dark tunnel. Along this tunnel are a number of lights, and each light is individually controlled by an adjacent switch. A group of people walk single file, and in an orderly manner, through the tunnel.
The first person throws every switch.
The second person throws every second switch (switches 2, 4, 6, 8…).
The third person throws every third switch (switches 3, 6, 9, 12…).
The fourth person throws every fourth switch.
And so on.
As the last person leaves the tunnel having thrown just the last switch, 5000 of the lights are off. How many lights are on?
Provide a logical explanation. Brute force is not allowed.
Julian F. G. W.
The first person throws every switch.
The second person throws every second switch (switches 2, 4, 6, 8…).
The third person throws every third switch (switches 3, 6, 9, 12…).
The fourth person throws every fourth switch.
And so on.
As the last person leaves the tunnel having thrown just the last switch, 5000 of the lights are off. How many lights are on?
Provide a logical explanation. Brute force is not allowed.
Julian F. G. W.

 Lemon Quarter
 Posts: 2941
 Joined: November 4th, 2016, 8:17 pm
 Has thanked: 296 times
 Been thanked: 421 times
Re: The Long Tunnel
The hardest part is to infer the question. Does the description "dark" imply all the lights are off, or is it merely a description of the tunnel's natural state? Oh well, I guess we need the assumption for there to be a numeric solution.
You have only twelve cases, being the lowest common multiple of 1, 2, 3 and 4. Any light n+12 ends up in the same state as light n.
Lights 1, 5, 7 and 11 are switched once only, so end up ON.
Lights 2, 3, 9 and 10 are switched by two people, so end up OFF.
Lights 4, 6 and 8 are stitched by three people  ON.
Light 12 is switched by everyone  OFF, and probably worn out.
So that's a ratio of 7:5 on vs off. The number ON at the end is 7000 or 7001.
And the people in the puzzle are Charlie Chaplin from Modern Times.
You have only twelve cases, being the lowest common multiple of 1, 2, 3 and 4. Any light n+12 ends up in the same state as light n.
Lights 1, 5, 7 and 11 are switched once only, so end up ON.
Lights 2, 3, 9 and 10 are switched by two people, so end up OFF.
Lights 4, 6 and 8 are stitched by three people  ON.
Light 12 is switched by everyone  OFF, and probably worn out.
So that's a ratio of 7:5 on vs off. The number ON at the end is 7000 or 7001.
And the people in the puzzle are Charlie Chaplin from Modern Times.

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
UncleEbenezer wrote:The hardest part is to infer the question. Does the description "dark" imply all the lights are off, or is it merely a description of the tunnel's natural state? Oh well, I guess we need the assumption for there to be a numeric solution.
That is a correct inference. If any of the lights were on, the tunnel would not be dark.
There are more than four people, however:
jfgw wrote:The first person throws every switch.
The second person throws every second switch (switches 2, 4, 6, 8…).
The third person throws every third switch (switches 3, 6, 9, 12…).
The fourth person throws every fourth switch.
And so on.
i.e., the nth person throws every nth switch.
Julian F. G. W.

 Lemon Quarter
 Posts: 2941
 Joined: November 4th, 2016, 8:17 pm
 Has thanked: 296 times
 Been thanked: 421 times
Re: The Long Tunnel
jfgw wrote:UncleEbenezer wrote:The hardest part is to infer the question. Does the description "dark" imply all the lights are off, or is it merely a description of the tunnel's natural state? Oh well, I guess we need the assumption for there to be a numeric solution.
That is a correct inference. If any of the lights were on, the tunnel would not be dark.
There are more than four people, however:jfgw wrote:The first person throws every switch.
The second person throws every second switch (switches 2, 4, 6, 8…).
The third person throws every third switch (switches 3, 6, 9, 12…).
The fourth person throws every fourth switch.
And so on.
i.e., the nth person throws every nth switch.
Julian F. G. W.
Then the question is underspecified. Since there's a last person out, the number is finite. But how many people altogether? The only assumption that kindof works is at least as many people as switches, but I have to go out in a few minutes so no time for that. And how many of them can keep up the pattern for thousands of switches: I'd be sure to lose count somewhere, not to mention get bored!

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
UncleEbenezer wrote:Since there's a last person out, the number is finite. But how many people altogether? The only assumption that kindof works is at least as many people as switches
No assumption is needed. There is enough information in the question to find the answer.
UncleEbenezer wrote: And how many of them can keep up the pattern for thousands of switches: I'd be sure to lose count somewhere, not to mention get bored!
It would be more boring to walk through the tunnel without anything to do. Maybe the switches were numbered.
Julian F. G. W.

 Lemon Quarter
 Posts: 2941
 Joined: November 4th, 2016, 8:17 pm
 Has thanked: 296 times
 Been thanked: 421 times
Re: The Long Tunnel
OK, quick and rough:
After the first person, all lights are on.
After the second, half the lights are on.
After the third, half the lights are still on: equal numbers have changed each way.
After the fourth, 75% of the lights are on: (s)he has undone half the work of #2, while #3 is still coprime.
#5 is as #3.
#6 reverses one third of the work of #2 and #4, but in equal measure.
By induction, all we care about is powers of 2. So we're going to end up with the convergence of 1  1/2 + 1/4  1/8 + 1/16 ...
After the first person, all lights are on.
After the second, half the lights are on.
After the third, half the lights are still on: equal numbers have changed each way.
After the fourth, 75% of the lights are on: (s)he has undone half the work of #2, while #3 is still coprime.
#5 is as #3.
#6 reverses one third of the work of #2 and #4, but in equal measure.
By induction, all we care about is powers of 2. So we're going to end up with the convergence of 1  1/2 + 1/4  1/8 + 1/16 ...

 Lemon Quarter
 Posts: 2941
 Joined: November 4th, 2016, 8:17 pm
 Has thanked: 296 times
 Been thanked: 421 times
Re: The Long Tunnel
jfgw wrote:It would be more boring to walk through the tunnel without anything to do. Maybe the switches were numbered.
Julian F. G. W.
Nonsense. Walking with the mind and body free is one of the best ways to pass time.

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
UncleEbenezer wrote:By induction, all we care about is powers of 2. So we're going to end up with the convergence of 1  1/2 + 1/4  1/8 + 1/16 ...
=2/3 of something.
You need a different approach to get the correct answer.
Julian F. G. W.
Re: The Long Tunnel
The nth light remains on if and only if n has an odd number of divisors, which means n is a perfect square.
So if we have x lights int(sqrt(x)) remain on.
Of the first 5000 lights 70 will remain on, so we have at least 5070 lights, possibly one or two more due to rounding. At this point calculating a few square roots is easier than further theorizing. Does a search space of size three still constitute brute forces?
Anyway there are 5071 lights and 71 remain on.
So if we have x lights int(sqrt(x)) remain on.
Of the first 5000 lights 70 will remain on, so we have at least 5070 lights, possibly one or two more due to rounding. At this point calculating a few square roots is easier than further theorizing. Does a search space of size three still constitute brute forces?
Anyway there are 5071 lights and 71 remain on.

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
That is the correct answer 9873210. A little trial and error is not brute force!
Since the last person to leave threw just the last switch, there must have been the same number of people as there were lights.
Julian F. G. W.
Since the last person to leave threw just the last switch, there must have been the same number of people as there were lights.
Julian F. G. W.

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
StepOne wrote:jfgw wrote:That is the correct answer 9873210.
Wow! I was miles out....
StepOne
If the answer was 9873210, it would be a long tunnel. If the switches were 2" apart, the tunnel would be long enough to reach from the sun to Neptune. I hope everyone took a packed lunch!
Julian F. G. W.

 Lemon Quarter
 Posts: 2575
 Joined: November 4th, 2016, 1:17 am
 Been thanked: 1212 times
Re: The Long Tunnel
jfgw wrote:StepOne wrote:jfgw wrote:That is the correct answer 9873210.
Wow! I was miles out....
If the answer was 9873210, it would be a long tunnel. If the switches were 2" apart, the tunnel would be long enough to reach from the sun to Neptune. ...
It would certainly be a long tunnel, but...
9873210 * 2" = 9873210 * 2 / (12 * 5280) miles = about 311.65 miles
Has Neptune shifted orbit dramatically while I haven't been looking??? ;)
Gengulphus

 Lemon Slice
 Posts: 765
 Joined: November 4th, 2016, 3:36 pm
 Has thanked: 102 times
 Been thanked: 167 times
Re: The Long Tunnel
Gengulphus wrote:It would certainly be a long tunnel, but...
9873210 * 2" = 9873210 * 2 / (12 * 5280) miles = about 311.65 miles
Has Neptune shifted orbit dramatically while I haven't been looking???
Ah, it seems that I forgot my own question. If 9873210 of the lights were on, the tunnel would be long enough to reach from the sun to Neptune.
Julian F. G. W.

 Lemon Quarter
 Posts: 2575
 Joined: November 4th, 2016, 1:17 am
 Been thanked: 1212 times
Re: The Long Tunnel
jfgw wrote:Gengulphus wrote:It would certainly be a long tunnel, but...
9873210 * 2" = 9873210 * 2 / (12 * 5280) miles = about 311.65 miles
Has Neptune shifted orbit dramatically while I haven't been looking??? ;)
Ah, it seems that I forgot my own question. If 9873210 of the lights were on, the tunnel would be long enough to reach from the sun to Neptune.
Actually, I forgot your question as well  you did ask "How many lights are on?", and not "How many lights are there in total?", which is the incorrectlyremembered question my calculation was based on.
But of course, the answer to "How many lights are on?" being 9873210 only implies that something in the preceding description is incorrect. If that something is that the number of lights that are off is 5000 and the true number is something else, then yes, the tunnel length would be about distance from the Sun to Neptune. On the other hand, if that something is when the number of lights that are off is 5000 and it actually happens at some other time, then the length of the tunnel is (9873210+5000) * 2" = about 311.81 miles. And there are other possibilities besides those two for what the something that is wrong is...
Gengulphus
Return to “Games, Puzzles and Riddles”
Who is online
Users browsing this forum: No registered users and 2 guests