class Integer def divide return 4.0 / (self * 2 - 1); end end answer = 4.0 / 1 c = 2 while c < 10000000 do if (c % 2 == 0) then puts (answer = answer - c.divide) else puts (answer = answer + c.divide) end c += 1 end