Citadel OA | Prime Factor Visitation | Citadel Online Assessment Question
Alex entered a room with some fancy lights arranged in a row which were either on or off. Alex had a list of numbers and worked through each number on that list in order. For each number, Alex visited the bulbs at positions which were a multiple of the prime factors of the chosen number. Whenever a bulb was visited, its state was flipped. Determine the final state of each bulb after the numbers on the list were processed.
Note: this problem use 1-based indices.
Relevant Citadel OA Problems:
states = [1,1,0,0,1,1,0,1,1,1] numbers = [3,4,15]
[1,0,0,1,0,0,0,0,1,1]
Initial state:
[1,1,0,0,1,1,0,1,1,1]
numbers[0]=3, there is one prime factor (3). After the states are changed, affected bulbs in bold:
[1,1,1,0,1,0,0,1,0,1]
numbers[0]=4, there is one prime factor (2). After the states are changed, affected bulbs in bold:
[1,0,1,1,1,1,0,0,0,0]
numbers[0]=15, the prime factors (3,5). After the states are changed, affected bulbs in bold:
[1,0,0,1,1,0,0,0,1,0]
[1,0,0,1,0,0,0,0,1,1]
1<=n<=10^51<=m<=10^50<=states[i]<=11<=numbers[i]<=2*10^5