Number the door from 1 to 500.Let’s start with some examples- door 12 is toggled on days 1,2,3,4,6,12;door 3 is toggled on day 1 and 3;door 1 is toggled on day 1;door 5 on 1 and 5.All doors are initally closed.What are the doors that are open at the end?

0

A door is toggled as many times as its number has divisor(this is obvious from the patterns shown in the question).

Divisors come in pairs: 2*3,6*1,1*5

So door with number having even divisors are finally closed.

Numbers which have odd number of divisors are perfect squares.So 1,4,9,16,25,36,….484 are doors that are open at the end!