Iggy Posted September 27, 2003 Share Posted September 27, 2003 there are 1000 lockers and 1000 people, the 1st person opens ever locker, the second person changes every other locker (2,4,6, was (if it was open it is now closed), the 3rd person changes every 3rd locker, and the 4th person changes every 4th locker, and so on to all 1000 pll do it.how many fucking lockers are open at the end???????? (i kno teh answer just to tell u this is a 6th grade math question) this is just to stump ppl EDIT: another example, if its the 31st person hed change every 31st locker which is locker 31,62,and 93) Link to comment
#ImVision# Posted September 27, 2003 Share Posted September 27, 2003 Goddammitt!! I know this question - i remember it from when i was in yr 7, but i cant remeber the answer!!!! Link to comment
True Posted September 27, 2003 Share Posted September 27, 2003 I am bored and should be going to sleep in the morning, so i'll write a script that'll calculate it out in a sec... *** <?php /* 1000 lockers, 1000 people. 1st opens all lockers, 2nd opens 2,4,6, 3rd 3,6,9 etc until 1000 people open lockers. how many have been opened? */ $i = 1; while ($i != 1001) { $a = $a + $i; if ($a < 1001) { ++$z; } else { $a = 0; ++$i; } } die("$z"); ?> Answer: 7069. But the real answer is 1000, because if you have 1000 lockers to open, the first person would have already opened them all. Since there was no close routine, the second person wouldn't have anything to open, etc. Link to comment
Alex3305 Posted September 27, 2003 Share Posted September 27, 2003 0 ! I think that is the awnser.. Link to comment
Iggy Posted September 27, 2003 Author Share Posted September 27, 2003 nope, not close Link to comment
True Posted September 27, 2003 Share Posted September 27, 2003 Oops, sorry, read the question wrong NOW I understand. Writing a new script... <?php $debug = 0; while ($i != 1001) { ++$i; $p = 0; while ($p < 1001) { $p = $p + $i; $z = $a[$p]; if ($z) { $z = "0"; } else { $z = "1"; } $a[$p] = $z; } if ($debug) { $c = ""; while ($d != 1000) { $c = "$c$a[$d]"; ++$d; } echo "$c "; $d = 0; } } while ($b != 1000) { if ($a[$b] == "1") { ++$total; } $z = "$z$a[$b]"; ++$b; } echo "Locker Status: $z "; echo "Total Open: $total "; echo "Total Closed: ".(1000 - $total).""; ?> So the answer is 31 open lockers... wish I read it right to begin with Link to comment
RobZGod Posted September 27, 2003 Share Posted September 27, 2003 No lockers are open at the end, person number 5 throws a twinky to the end of the hall and a fat kid runs after it, shutting all the locker doors with his immense bulk. Link to comment
Guest Posted September 28, 2003 Share Posted September 28, 2003 god im tired my ass hurt my brain hurts my tessticals hurt.YAWN....OW.im..............going.................to.................bed. Link to comment
Iggy Posted September 28, 2003 Author Share Posted September 28, 2003 TRUE GOT IT RIGHT, 31 LOCKERS Link to comment
Iam A. Spammer Posted September 28, 2003 Share Posted September 28, 2003 I'm with RobZGod, they're all closed! Link to comment
RobZGod Posted September 29, 2003 Share Posted September 29, 2003 Tip #1: If somethings too hard to work out, just be dumb. Yet be funny, because that kind of guy gets the social life Link to comment
True Posted September 29, 2003 Share Posted September 29, 2003 What is a social life? Link to comment
Iggy Posted September 30, 2003 Author Share Posted September 30, 2003 I agree, what IS a social life? Link to comment
Iam A. Spammer Posted September 30, 2003 Share Posted September 30, 2003 Its when you're not talking to your feet cuz your lonely I guess! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now