Question 1132246
.


            It is very well known problem, and you can find many solutions in the Internet or even at this forum's archive.


            The difference is only in the form of presenting the solution.


            Below I present my own version of the solution.



<pre>
Let N be the number (the label) of some current locker. So, N is the number between 1 and 1000.


Let  {{{d[1]}}}, {{{d[2]}}}, {{{d[3]}}}, . . . , {{{d[m]}}}  be the divisors of the number N in the ascending order, from 1 to N inclusively.


The initial/original state of the locker N is "OPEN".

Notice that if the number of the current step is not a divisor of N, then the status of the locker N is not changed at this step.
It is changed if and only if the number of the step is the divisor of the number N.
Every time, when the number of the step is the divisor of N, the status of the locker is changed to the opposite one.


    Thus,    at the step {{{d[1]}}} it will be changed to the opposite status "CLOSED".

    Further, at the step {{{d[2]}}} the status will be changed to the opposite status "OPEN".

             At the step {{{d[3]}}}, the status will be changed to the opposite status "CLOSED".

    And so on . . . 



So, if the number N has EVEN number of divisors in the set {{{d[1]}}}, {{{d[2]}}}, {{{d[3]}}}, . . . , {{{d[m]}}}, 
    then the locker N will have the same final status after completing the full procedure as its original status.


On the contrary, if the number N has ODD number of divisors in the set {{{d[1]}}}, {{{d[2]}}}, {{{d[3]}}}, . . . , {{{d[m]}}}, 
    then the locker N will have the opposite status after completing the full procedure comparing with its original status.


In other words, if the number N has EVEN number of divisors, its final status will be "OPEN".

Otherwise,      if the number N has ODD  number of divisors, its final status will be "CLOSED".


Now, if  N = {{{p[1]^k[1]}}}.{{{p[2]^k[2]}}}.{{{p[3]^k[3]}}} . . . {{{p[m]^k[m]}}}  is the decomposition 

         of the number N into the product of prime numbers, then the number of divisors is  {{{(k[1]+1)}}}.{{{(k[2]+1)}}}.{{{(k[3]+1)}}} . . . {{{(k[m]+1)}}}.


This number is ODD if and only if each factor of the last product is odd.

In other words, the number of divisors of the given number N is odd if and only if each prime in its prime decomposition has an EVEN degree.

It means that the number of divisors of the given number N is odd if and only if it is <U>A SQUARE</U>.


Returning to our problem,  the numbers N of the sequence  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, . . . , 1000 for which the final status  
of the locker N will be "CLOSED" are the squares  1, 4, 9, 16, 25, 36, 49, 64, 81, 100, . . . , {{{31^2}}} = 961.


There are exactly 31 such numbers.


For the rest values N of the sequence  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, . . . , 1000  the final status of the locker N will be "OPEN",
and the number of such lockers is  1000-31 = 969.


<U>ANSWER</U>.  At the end of exercise, 31 lockers will be closed.
</pre>