Google’s Treasure Hunt Hint Hint

May 18th, 2008

Google is hosting another great treasurehunt at http://treasurehunt.appspot.com/. A good friend (and awesome upcoming coder) Lauren and I are working at the library together and we just had a go at it. It turns out there’s a beautiful connection between the answer for any given n*m grid and Pascal’s triangle. Keep your eyes open for those numbers!

Kudos to Lauren for spotting the connection: “Wait isn’t this those, whaddumacallit, triangle numbers?”

                             1
                         1       2
                     1       4       4
                 1       6       12      8
             1       8       24      32      16
         1       10      40      80      80       32
     1       12      60      160     240     192       64
 1       14      84      280     560     672      448       128

Update: After a few premature victory celebrations, we finally got the answer in the form of a short Ruby script. With the following methods…

class Fixnum
  def factorial
    if self <= 0
      return 1
    else
      return self * (self-1).factorial
    end
  end

  def choose n
    ((self.factorial)/(n.factorial*(self-n).factorial))
  end
end

The solution is a simple one-liner.

One Response to “Google’s Treasure Hunt Hint Hint”

  1. Wave Invites Says:

    Wave Invites…

    What a refreshing topic! I really enjoyed your point of view and can’t wait to read some of your upcomming posts. I’m going to link to your blog if you don’t mind as I think my readers might find some value in your topics….

Leave a Reply

You must be logged in to post a comment.