Imagine 30 doors in a row, numbered 1 to 30. At the start every door is closed. Then you follow this routine:

  1. On the 1st pass, you toggle (open if closed, close if open) every door (every 1st door).
  2. On the 2nd pass, you toggle every 2nd door (doors 2, 4, 6, ...).
  3. On the 3rd pass, you toggle every 3rd door (doors 3, 6, 9, ...).
  4. You keep going like this: on pass k toggle every k-th door, up to pass 30.

Question: After the 30th pass, which doors are left open?