Open door

A corridor has 1000 doors which are all closed.

  • The first person to walk along the corridor changes the state of every door: they open every closed door.
  • The second person only changes the state of every second door: they close every open door.
  • The third person only changes the state of every third door: if it is open they close it, and if it is closed they open it.
  • The fourth person only changes the state of every fourth door, and so on.

How many doors are open after the 100 0 th 1000^\text{th} person has walked down the corridor?

30 31 32 33

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Giorgos K.
Mar 22, 2018

It is obvious that we are searching for perfect squares (numbers with odd number of divisors) under 1000.
here is how you can do this in Mathematica
Floor@Sqrt@1000

but if you like to open and close doors, here is a much more difficult problem in ProjectEuler

Laurence Satow
Mar 22, 2018

There are 31 square numbers less than 1000.

The only doors which will be open are those that are square numbers because square numbers have an odd number of factors. All other numbers have an even number of factors so will end up shut.

eg door 8 is opened by person 1 shut by 2 opened by 4 and shut by 8 all other people ignore door 8

door 9 is opened by person 1 shut by person 3 and opened by person 9 all other people ignore door 9

31 times 31 is 961 but 32 times 32 is 1024.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...