Riker's Mailbox

Wednesday, January 19, 2005

CONFORMANCE

In the last month, there have been no small number of adjustments... no, resolutions... to my life that have permitted me to fall helplessly in love with where I am right now, even despite the now comical beleaguerement that is my long-term status as a bachelor with a heartache for feminine companionship and a soft spot for chick flicks.

Incidentally,

HOLY SHIT.

When I wasn't paying attention, the world's celestial odometer rolled past 2005 laps since the beginning of that crazy rally-race, "The Jesus' Beeline To Armageddon", and I forgot to blog about it. Needless to say, I had a rip-roarin' time: I (1) partied with several groups of friends, (2) commiserated with out-of-town pals of yesteryear, (3) negotiated a potential business partnership that could potentially have million-dollar-potential, (4) discovered that I "roll deep", (5) performed a killer rendition of Tenacious D's Fuck Her Gently while doped up on Bailey's and energy drinks, (6) made some amazing new friends out of old acquaintances, (7) welcomed a pair of ass-kicking tenants into my home, (8) kidnapped my best friend and let her lead my associates and I on an 8-day movie and drinking binge, (9) discovered that I make a bread-dipping oil so delicious that people start putting it on a whole slew of other foods that are in no way related to bread, and (10) was accused of sleeping with someone's girlfriend, when I had in fact only slept next to her, and only after she broke up with the aforementioned accuser.

I also drank a lot of coffee.

Despite this, I went to bed early more often than I ever used to. I can't tell really whether I'm needing more sleep or my friends are needing less. The average bedtime in my house (which has, incidentally, become a bed-and-breakfast of sorts in the last two weeks - we have housed no fewer than four unique guests for periods of at least three days in my living room, in addition to the permanent 5-person tenancy of the house itself) is somewhere between 3am and 7am, depending on how many episodes of 'Family Guy' are on my computer, and on how much Paige has had to drink (love you, hon!). It's remarkable what an effect that girl has on our day-to-day. In about a week, she'll return to SUNY Binghampshireburg, and gone will be the glue that's held this wild ride together. We're planning to go down and visit her within a week from then. She's honestly like gravity.

While there's much more to say, I'll let it go for another time. I'll leave you with a question taken from my housemate Amanda's homework. I encourage you to take a stab at it:

There is a highschool with exactly 1000 students and exactly 1000 lockers. One day, the students line up and perform the following: Student 1 goes inside and opens every single locker door. After he's done, Student 2 goes in, starting from the second locker, and 'reverses' every second locker door thereafter(since they're all open, he is only closing lockers). Student 3 goes in next, and starting from the third locker, 'reverses' every third locker door in the school (opening ones that are closed and closing ones that are open). The fourth student reverses every fourth locker, and so on until every student has passed through the school. At the end of this procedure, precisely which lockers will be open and which will be closed?

There are a few ways to solve this, the hardest of which would be to crunch the numbers manually, and the easiest of which (for some of us) would be to write a computer program to perform the operation for you, but for the rest of you who want nothing to do with either of the previous suggestions, there are patterns in the data, and with a basic knowledge of math and a little creativity, you'll be able to solve it with a generic expression of rules by which you can identify which lockers will be open.

To everyone who wants to play along, work out the problem on your own and time yourself. When you're done and have a solution you want to present, go ahead and put it up on the comments section under this post, along with how long it took you to figure it out.

First person to post a comment with the correct solution in the shortest time (this does not necessarily mean the first person to post correctly... I'm going on the honor system here, but if you solve it in ten minutes and you post after a person who did it in twenty, YOU win) wins a six-pack of their drink of choice, as long as I am capable of delivering it to them. A word of warning, there are different ways to successfully determine the solution, and some are more elegant than others. There is only one solution I will consider complete and correct.

Go for it! Come on, there's free alcohol in it for you!

5 comments:

  1. After all the lockers have been opened, to remain open after all 1000 students have been through the school they must be opened and closed and even number of times.
    Therefore, the ith locker will remain open if it can be divided exactly by and interger number and even number of times where the number that is being divided by is all the integers less than it....

    Lockers Open: 31 (hint: the squares...)
    1
    4
    9
    16
    25
    36
    49
    64
    100
    121
    144
    159
    196
    225
    256
    289
    324
    361
    400
    441
    484
    529
    576
    625
    676
    729
    784
    841
    900
    961


    Kevin, if I'm wrong...a PhD helped...if I'm right...a PhD still helped....we can share the "prize" if applicable...
    P.S loved the blog...Jesus part on point and you DO roll deep :o)

    ReplyDelete
  2. I dunno hon... you neglected to mention how long it took you to determine your solution; that is a criterion for me to determine a winner. Having had help on the solution is not a real issue; I know I certainly spent a good bit of time discussing it with a cohort in order to work out the problem. There's still a simpler way to explain the logic behind the solution, but your answer was definitely accurate.

    ReplyDelete
  3. Riker:

    Gotta say I wrote a program to do it. Took me 4 minutes. Actually had to re-read it after I did the first version, cause I didn't realize I was to skip lockers, and I was like -- it seems too easy, every other locker! Here's my results:

    0 = closed
    1 = open

    paisley@peeimp ~ {120}$ ./norf | grep ': 1'
    Locker #1: 1
    Locker #4: 1
    Locker #9: 1
    Locker #16: 1
    Locker #25: 1
    Locker #36: 1
    Locker #49: 1
    Locker #64: 1
    Locker #81: 1
    Locker #100: 1
    Locker #121: 1
    Locker #144: 1
    Locker #169: 1
    Locker #196: 1
    Locker #225: 1
    Locker #256: 1
    Locker #289: 1
    Locker #324: 1
    Locker #361: 1
    Locker #400: 1
    Locker #441: 1
    Locker #484: 1
    Locker #529: 1
    Locker #576: 1
    Locker #625: 1
    Locker #676: 1
    Locker #729: 1
    Locker #784: 1
    Locker #841: 1
    Locker #900: 1
    Locker #961: 1

    paisley@peeimp ~ {121}$ ./norf | grep ': 1' | wc
    31 93 453

    (that means there are 31 of them). Also -- Here's the code that produced it... note the annoying use of starting loops @ 1 and going to <= N_LOCKERS.

    This was written in C

    #define CLOSE 0;
    #define OPEN 1;
    #define N_LOCKERS 1000

    int
    main( void )
    {
    int lockers[ N_LOCKERS ];
    int i;
    int s;

    for( i = 0; i < N_LOCKERS; i += 1 ) {
    lockers[i] = 0;
    }

    for( i = 1; i <= N_LOCKERS; i += 1 ) {
    for( s = i; s <= N_LOCKERS; s += i ) {
    lockers[s-1] = !lockers[s-1];
    }
    }

    for( i = 1; i <= N_LOCKERS; i += 1 ) {
    printf( "Locker #%d: %d\n", i, lockers[i-1] );
    }

    return EXIT_SUCCESS;
    }

    I hope I win! :) (preview shows it screws my indenting on the code -- I'll post it elsewhere if anyone's interested, but you should get the point)

    ReplyDelete
  4. PS...it took me 30seconds..to figure out to ask my resident PhD to write the code...and five minutes for him to do it and call me back...... :o)

    ReplyDelete
  5. Anonymous10:20 PM

    kevin aka my favorite,
    that was one of the kindest and greatest things ive ever read about myself. thanks for much for such a wonderful break....and we shall be back together to do it all over again in no time. you are my best friend and i love you dearly.
    luv, your favorite,
    paige

    ReplyDelete