and only if it is a perfect square, i.e., i = j2.
Hence doors that are in the positions that are perfect squares and only
such doors will be open after the last pass.
The total number of such
positions not exceeding n is equal to ?√n?: these numbers are the squares
of the positive integers between 1 and ?√n? inclusively.