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 2 of 3 |
Heuristic thinking:  each light is on half the time, off half the time.
The number of lights on can take on 4 values: 0, 1, 2, 3
Success occurs with 2 or 3, Failure with 0 or 1.   Success with half the cases.
For one full cycle, the answer must be half the time:  30 seconds out of one minute.

But we are asked about one full minute.  If the start time is some random time with no knowledge of where each light is in its cycle, will the answer still be 'half the time'?  It depends on when the 60 seconds begins relative to the time the 3 cycles are synced up.

If it starts just as they all turn on. then the sensor is activated for 32 of the 60 seconds.
At random starting states, the number of seconds per minute the sensor is activated varies from 28 to 32 seconds.  Over the entire cycle it still averages out to 30 seconds.

Program output, full cycle of number of lights on each second.
Although I ran this for 480 seconds, the pattern repeats every 120 seconds.
[3, 3, 3, 2, 1, 0, 1, 1, 2, 1, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 1, 1, 1, 3, 2, 2, 1, 0, 0, 2, 2, 3, 2, 2, 1, 1, 1, 1, 0, 2, 2, 3, 3, 2, 0, 0, 0, 2, 2, 3, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 2, 1, 0, 1, 1, 3, 3, 3, 1, 0, 0, 1, 1, 3, 2, 2, 2, 2, 1, 1, 0, 1, 1, 3, 3, 2, 1, 1, 0, 2, 2, 2, 1, 1, 1, 2, 2, 3, 1, 1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 1, 1, 3, 3, 2, 1, 1, 0, 2, 2, 2, 1, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 2, 1, 0, 0, 0]

Counting up the frequency of each number:
 0    1    2   3  <-- (number of lights on)
[64, 176, 176, 64]

60 seconds while varying the initial state of lights:
[8, 20, 24, 8] 32
[8, 20, 25, 7] 32
[8, 20, 26, 6] 32
[8, 20, 27, 5] 32
[8, 21, 26, 5] 31
[8, 20, 27, 5] 32
[7, 21, 27, 5] 32
[7, 20, 28, 5] 33
[7, 19, 29, 5] 34
[7, 20, 28, 5] 33
[8, 19, 28, 5] 33
[8, 20, 27, 5] 32
[8, 21, 26, 5] 31
[8, 21, 25, 6] 31
[8, 21, 24, 7] 31
[8, 21, 23, 8] 31
[7, 22, 23, 8] 31
[8, 21, 23, 8] 31
[9, 20, 23, 8] 31
[9, 21, 22, 8] 30
[9, 22, 21, 8] 29
[9, 22, 20, 9] 29
[9, 21, 21, 9] 30
[9, 20, 22, 9] 31
[9, 19, 23, 9] 32
[9, 19, 24, 8] 32
[9, 20, 23, 8] 31
[9, 21, 22, 8] 30
[10, 20, 22, 8] 30
[9, 21, 22, 8] 30
[8, 22, 22, 8] 30
[8, 22, 21, 9] 30
[8, 22, 20, 10] 30
[8, 22, 21, 9] 30
[8, 23, 20, 9] 29
[8, 24, 19, 9] 28
[9, 23, 19, 9] 28
[9, 22, 20, 9] 29
[9, 21, 21, 9] 30
[9, 20, 22, 9] 31
[8, 21, 22, 9] 31
[8, 22, 21, 9] 30
[8, 23, 20, 9] 29
[8, 23, 21, 8] 29
[8, 23, 22, 7] 29
[8, 23, 21, 8] 29
[7, 24, 21, 8] 29
[6, 25, 21, 8] 29
[5, 26, 21, 8] 29
[5, 27, 20, 8] 28
[5, 28, 19, 8] 27
[5, 28, 20, 7] 27
[5, 29, 19, 7] 26
[5, 28, 20, 7] 27
[5, 27, 21, 7] 28
[5, 27, 20, 8] 28
[5, 26, 21, 8] 29
[5, 27, 20, 8] 28
[6, 26, 20, 8] 28
[7, 25, 20, 8] 28

----------
onList = [0,0,0,0]
history = []
for start in range(60):
    onList = [0,0,0,0]
    for t in range(start, start+60):
        if t%6 < 3:
            first = 1
        else:
            first = 0
        if t%8 < 4:
            second = 1
        else:
            second = 0
        if t%10 < 5:
            third = 1
        else:
            third = 0
        numberOn = first + second + third
        onList[numberOn] += 1
        history.append(numberOn)

    print(onList, onList[2]+onList[3])
    # print(history)

  Posted by Larry on 2023-11-27 10:38:17
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (5)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (10)
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