All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Lighthouse Crossed Three Lights Mashup (Posted on 2023-11-27) Difficulty: 2 of 5
On the coast there are 3 lighthouses. All 3 turn on at time zero.
- The first light shines for 3 seconds, then is off for 3 seconds.
- The second light shines for 4 seconds, then is off for 4 seconds.
- The third light shines for 5 seconds, then is off for 5 seconds.

A distant ship has an optical sensor aimed at the set of lighthouses, but it is far enough away that the sensor only activates when two of the lights are on at the same time.
Over the course of one minute, how often is the sensor active?

Original problem: Lighthouse Crossed Three Lights Muse

No Solution Yet Submitted by Brian Smith    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 1 of 3
The question asks how often the majority of the lighthouses are on.

By the symmetry of the fact that each lighthouse is off the same amount of time as it's on, the majority being off is the same as the majority being on. On average the  distant sensor is active half the time in the long run.

But the question asks How often is the sensor active?, not how long it's active.

It turns out, the sensor becomes active 10 times per minute. Its average duration of being active is 3 seconds, but it can be from 1 to 5 seconds. This assumes they start out in synchrony, all going on at the same time to begin with. It's active half the time, or on average 30 seconds per minute.

The following program keeps track of the cycles:

onTime=[]; offTime=[];
for i=1:3
  timeOn(i)=-1;
end
durOn=0;
for sec=0:239
  oldOn=sum(timeOn>=0);
  for i=1:3
    timeOn(i)=timeOn(i)+1;
    if timeOn(i)>=i+2
      timeOn(i)=timeOn(i)-2*(i+2);
    end
  end
  newOn=sum(timeOn>=0);
  % [sec timeOn(1) timeOn(2) timeOn(3)]
  if oldOn<2 && newOn>=2
    onTime(end+1)=sec;
  end
  if oldOn>=2 && newOn<2
    offTime(end+1)=sec;
  end
  if newOn>=2
    durOn=durOn+1;
  end
  if mod(sec+1,60)==0
    fprintf('%3d ',onTime); fprintf(' ');
    fprintf('%3d ',offTime); fprintf(' ');
    length(onTime)
    durOn
    disp(' ')
  end
end

It shows summaries for the first three minutes, with all three lighthouses going on simultaneously at t = 0 seconds.

It begins with the first minute:

  0   8  10  18  24  30  40  48  54  56 
  4   9  15  21  27  35  45  52  55  57 
ans =
    10
durOn =
    32
    
So during the first minute the distant sensor was on 32 seconds, the first occurrence of which was the four seconds from time zero to time 4, and the last was one second from t = 56 to t = 57. 

Then the first two minutes:
 
  0   8  10  18  24  30  40  48  54  56  60  64  66  72  80  90  96 102 110 112 
  4   9  15  21  27  35  45  52  55  57  63  65  68  75  85  93  99 105 111 116 
ans =
    20
durOn =
    60

The sensor was activated another 10 times in the second minute, but this time the total duration during the minute was only 28 seconds, bringing the total duration over the two minutes to the expected 60 over the 20 occurences.

This repeats over each 2 minute period thereafter:
 
  0   8  10  18  24  30  40  48  54  56  60  64  66  72  80  90  96 102 110 112
  120 128 130 138 144 150 160 168 174 176 
  4   9  15  21  27  35  45  52  55  57  63  65  68  75  85  93  99 105 111 116
  124 129 135 141 147 155 165 172 175 177 
ans =
    30
durOn =
    92
 
  0   8  10  18  24  30  40  48  54  56  60  64  66  72  80  90  96 102 110 112
  120 128 130 138 144 150 160 168 174 176 180 184 186 192 200 210 216 222 230 232 
  4   9  15  21  27  35  45  52  55  57  63  65  68  75  85  93  99 105 111 116
  124 129 135 141 147 155 165 172 175 177 183 185 188 195 205 213 219 225 231 236 
ans =
    40
durOn =
   120

Edited on November 27, 2023, 9:28 am
  Posted by Charlie on 2023-11-27 09:21:32

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information