Saturday, November 5, 2016

mathematics - Nerds, Jocks, and Lockers


Here's an oldie but goodie from The Daily WTF; I paraphrase to avoid copyright issues:



A middle school math teacher, who also happened to be the P.E. coach, made the following deal with the non-athletic "nerds" in each new math class he taught on their first day:



Outside the classroom was the main hallway, along one wall of which was an uninterrupted row of lockers numbered 1 through 100. As it was morning of the first day of school, the lockers hadn't been assigned yet and so didn't have any padlocks on them.


The "jocks" in the class would go out to the row of lockers, which were all closed, and begin opening all of them. Then they'd close every even-numbered locker, and then open or close every third locker, then every fourth locker, and so on up to 100, "toggling" each locker in the sequence, opening if it was closed, closing if it was open.


Once the jocks had toggled the last locker for the last time, a certain sequence of locker doors would be open. It was the nerds' job to figure out in a more elegant way which locker doors would still be open, before the jocks finished going through their "brute force" routine.


If the nerds cracked it, they were excused from PE class for the rest of the year. If they couldn't, they'd face the jocks in the traditional first-day dodgeball game. In the P.E. teacher's 30 year career, not a single nerd ever avoided his fate.



What sequence of doors remains open when toggled according to this sequence, and why? And no cheating, running up and down the halls of your own school toggling lockers.



Answer



Every locker is closed except for square numbers.


Say on turn 1, they make sure every locker is open.


On turn 2, they close the even lockers.



On turn 3, they toggle the lockers divisible by 3.


If locker N has a prime number, it will only be closed on turn N and opened on turn 1.


If locker N is even and greater than 2, it have been toggled on turn N/2.


If locker N is divisble by x and greater than s, it have been toggled on turn N/x.


If locker N is square, it will $\sqrt N=N/\sqrt N$ so this will cause it to be flipped a time with no corresponding pair.


This means every locker N will be toggled equal to the number of its unique factors.


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...