I'm in your Pi, crunching your numbers ;-)

03 05 2009

From Ruby Quiz #202:

And sometimes the fastest code is the code you don’t write. Michael Kohl’s solution:

require ‘rubygems’
require ‘hpricot’
require ‘open-uri’

doc = Hpricot(open(‘http://www.eveandersson.com/pi/digits/100000’))
puts (doc/‘pre’).inner_html

It finishes in less than one second for the entire 100,000 digits!

And no, this wasn’t a serious submission… :-)