diff --git a/pai9.jpg b/pai9.jpg new file mode 100644 index 0000000..8cee1ff --- /dev/null +++ b/pai9.jpg Binary files differ diff --git a/pai9.rb b/pai9.rb new file mode 100644 index 0000000..f7cae5e --- /dev/null +++ b/pai9.rb @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +#-*- coding: utf-8 -*- + +enshuritsu = 0.0 +x = 0 + +while x < 10000000 + + y = 4 * x + 1 + + z = 4 * x + 3 + + enshuritsu = enshuritsu + (1.0 / y) - (1.0 / z).to_f + x = x + 1 +end + +printf("%d回 円周率 %.20f\n",x,enshuritsu * 4.0) + + + + diff --git a/pai9kekka.txt b/pai9kekka.txt new file mode 100644 index 0000000..9e2f1b3 --- /dev/null +++ b/pai9kekka.txt @@ -0,0 +1,15 @@ +10回 円周率 3.09162380666783986882 + +100回 円周率 3.13659268483881614742 + +1000回 円周率 3.14109265362104128627 + +10000回 円周率 3.14154265358982476286 + +100000回 円周率 3.14158765358976177495 + +1000000回 円周率 3.14159215358972421228 + +10000000回 円周率 3.14159260358981695660 + +100000000回 円周率 3.14159264858940767695