s1=0.0 s2=0.0 for i in 1..10 s1 = s1 + 1 / i.to_f end for i in 2..5 s2 = s2 + 1 / (i*(i-1)).to_f end p s1 p s2 s1=2.92896825396825 s2=0.8