#!/usr/bin/ruby def pi(n) p = 2 # final product b = 0 # each denom for i in 1..n b = Math.sqrt(2 + b) t = 2.0/b # term p *= t if i%2 == 0 print " i: ", i, ", t: ", t, ", p: ", p, "\n" end end p end print "pi: ", pi(25), "\n"