1 n = 2_500_000 # (ARGV.shift || 1).to_i
3 alt = 1.0 ; s0 = s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = 0.0
6 d = d.to_f ; d2 = d * d ; d3 = d2 * d ; ds = Math.sin(d) ; dc = Math.cos(d)
8 s0 += (2.0 / 3.0) ** (d - 1.0)
9 s1 += 1.0 / Math.sqrt(d)
10 s2 += 1.0 / (d * (d + 1.0))
11 s3 += 1.0 / (d3 * ds * ds)
12 s4 += 1.0 / (d3 * dc * dc)
16 s8 += alt / (2.0 * d - 1.0)
22 printf("%.9f\t(2/3)^k\n", s0)
23 printf("%.9f\tk^-0.5\n", s1)
24 printf("%.9f\t1/k(k+1)\n", s2)
25 printf("%.9f\tFlint Hills\n", s3)
26 printf("%.9f\tCookson Hills\n", s4)
27 printf("%.9f\tHarmonic\n", s5)
28 printf("%.9f\tRiemann Zeta\n", s6)
29 printf("%.9f\tAlternating Harmonic\n", s7)
30 printf("%.9f\tGregory\n", s8)