arrayProjects_lockers--Write a program to solve the following logic/math puzzle:
Imagine 100 lockers numbered 1 to 100 in a hallway with 100 students lined up at the end of the hall:
The first student starts at the first locker opens it, then procedes to open every locker.
The second student starts at the second locker, closes it, then closes every second locker.
The 3rd student starts at the third locker, if the locker is closed, they open it, and if it is open, they close it. They continue to invert the state of every 3rd locker.
The 4th student starts at the 4th locker and changes every fourth locker.
The 5th student starts at the 5th locker and changes every fifth locker.
That same pattern continues for all 100 students.
Here’s the question: “Which lockers are left open after all 100 students have walked the row of lockers?”
Given n as the number of both lockers and students, return a String array displaying the state of each locker in the following format:
Locker Number x: Open or Locker Number x: Closed
Where x is the number of the locker in the sequence.
arrayProjects_lockers(0) → [] arrayProjects_lockers(1) → ["Locker Number 1: Open"] arrayProjects_lockers(5) → ["Locker Number 1: Open", "Locker Number 2: Closed", "Locker Number 3: Closed", "Locker Number 4: Open", "Locker Number 5: Closed"]