I also have an IQ question...


Status
Not open for further replies.

roygoh

Senior Member
Jan 18, 2002
5,011
0
0
Northwest
Visit site
Imagine there are 1000 switches, numbered from 1 to 1000 and lined up sequentially in a single row on a very long wall. Each switch controls a light bulb on top of the switch and all the switches are at the "OFF" position in the beginning.

Then imagine there are 1000 people, each wearing a number tag, and the numbers run from 1 to 1000.

The sequence of actions are:

Starting from the person with the number 1, each person in order of their number goes from switch number 1 to switch number 1000, and flick the switches that has the numbers that are multiples of the person's number.

Here's how it would have gone:

The person number 1 goes from switch number 1 to switch number 1000, and turns on every switch. (Since his number is 1, so every switch number is a multiple of 1).

The person number 2 goes from switch number 1 to switch number 1000, and turns off all the switches with numbers that are multiples of 2, ie, 2,4,6,.....1000. (Since the 1st person turned on all the switches, the second person then turns off all the even number switches).

The person number 3 then turns switch number 3 off (initially turned on by peron number 1), turns switch number 6 on (initially turned on by person number 1 then turned off by person number 2), switch number 9 off.....

.
.
.
.

Person number 1000 simply go to switch number 1000. If it is on, he turns it off, it it is off, he turns it on.

The question is, by the end of the whole exercise, how many light bulbs are lit? :dunno:

This was a question given to me on my job interview... :eek:

- Roy
 

Originally posted by roygoh
Imagine there are 1000 switches, numbered from 1 to 1000 and lined up sequentially in a single row on a very long wall. Each switch controls a light bulb on top of the switch and all the switches are at the "OFF" position in the beginning.

Then imagine there are 1000 people, each wearing a number tag, and the numbers run from 1 to 1000.

The sequence of actions are:

Starting from the person with the number 1, each person in order of their number goes from switch number 1 to switch number 1000, and flick the switches that has the numbers that are multiples of the person's number.

Here's how it would have gone:

The person number 1 goes from switch number 1 to switch number 1000, and turns on every switch. (Since his number is 1, so every switch number is a multiple of 1).

The person number 2 goes from switch number 1 to switch number 1000, and turns off all the switches with numbers that are multiples of 2, ie, 2,4,6,.....1000. (Since the 1st person turned on all the switches, the second person then turns off all the even number switches).

The person number 3 then turns switch number 3 off (initially turned on by peron number 1), turns switch number 6 on (initially turned on by person number 1 then turned off by person number 2), switch number 9 off.....

.
.
.
.

Person number 1000 simply go to switch number 1000. If it is on, he turns it off, it it is off, he turns it on.

The question is, by the end of the whole exercise, how many light bulbs are lit? :dunno:

This was a question given to me on my job interview... :eek:

- Roy

And your answer was???
One?

The first light bulb will never be turned off as '1' is only a multiple of 1.

This is a maths question I think.
 

My guess is -

S = (n/2)[2a+(n-1)d] + n

S = 1000,
n = to find
a = 2
d = 2

thus n=30.63

taking the approximate value, it is 31 light bulb on.
 

Hahaha... then you give them a cheeky answer loh.
At the end of the exercise, you will turn off all the bulbs that are on. So in the end, there will be no light bulbs on.
 

For lightbulb 1, only Mr1 can touch it, so it can only be switched on.

For lightbulb 4, Mr1 switch it on, Mr2 switch it off, Mr4 switch it on.
So it is switched on.

For lightbulb 9, Mr1 switch it on, Mr3 switch it off, Mr9 switch it on.
So it is switched on.

According to the logic above, Switch 1,4,9,16,25, and so on are switched on.

Note that there are
2 switches between 01 and 04 are off->2.3
4 switches between 04 and 09 are off->5.6.7.8
6 switches between 09 and 16 are off->10.11.12.13.14.15
8 switches between 16 and 25 are off->17.18.19.20.21.22.23.24
and so on.

So the thing is to find n.

S > (n/2)[2a+(n-1)d] + n

S = 1000,
n = to find
a = 2
d = 2

Thus n=30
This seems like the answer, but we need to sub in n=30 into
n(n+2) and see what the sum is, it is 960, means we can add one more litted bulb after this, namely switch 961.

Thus the total number of switches on is 31

:D
 

Chee Chee,
Once the pattern that shows that the squares are the remaining numbers, the extrapolation is trivial; the biggest square before 1000 is 31. Hence, the total number would be 31.

To be sure and fast, I would write a program to simulate it.
 

Originally posted by Watcher
Chee Chee,
Once the pattern that shows that the squares are the remaining numbers, the extrapolation is trivial; the biggest square before 1000 is 31. Hence, the total number would be 31.

To be sure and fast, I would write a program to simulate it.
>the extrapolation is trivial; the biggest square before 1000 is >31. Hence, the total number would be 31.
Err.. dun understans:dunno:

Aiyaah.... limited time mar, only 20minutes for me to solve.

;) confirm got faster way to solve than my kind of primitive methods
 

As I said....
Tell them that you will switch everything off... cos waste of electricity.... then they will probably give you a job as resource manager instead of whatever you are applying for. hahaha.....
 

Hehe.. then might as well tell them "Why use so many lightbulbs? Use 1 big output one then can liao mar.."

Voila, the post of R&D director.
:devil:
 

Here's the "standard" answer I gave:

At the end of the exercise, switches that are flicked an odd number of times will be on.

The number of times a switch is flicked is equal to the number of factors its number has.

All numbers have even number of factors except square numbers.

For example, 12 (not a square number) = 1 X 12 = 2 X 6 = 3 X 4, so there are 6 factors (1,2,3,4,6,12). Swich 12 is therefore flicked an even number of times, so it is off.

36 (a square numner) = 1 X 36 = 2 X 18 = 3 X 12, = 4 X 9 = 6 X 6. So there are 9 factors, which is a odd number. Switch 36 is flicked an odd numner of time, so it is on.

The number of switches that are on
= the number of switches that are flicked an odd number of times
= the number of switches that has a square number
= the number of square numbers from 1 to 1000 (including 1 itself)
= Integer(square root of 1000)
= 31.

So cheechee's answer is correct!

- Roy
 

What kind of a job is that?????

Think Ur interviewer has a very good sense of humour.....

:bsmilie:
 

Someone should write a short program in C or what ever, and see if the answer is 31.
 

Status
Not open for further replies.