Fixed #3 in ruby.

I completely forgot to add a sqrt, which cuts a huge amount of time.