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