圆周率计算之最简单的Python程序# -*- coding
python吧
全部回复
仅看楼主
level 2
idealguy 楼主
圆周率计算之最简单的Python程序
# -*- coding: UTF-8 -*-
# calculating PI with a simple series
# Author: Li-Deming,2018
# pi=2*(1+1/3+1/3*2/5+1/3*2/5*3/7+...)
#
print ("高精度圓周率計算程序")
n=10004
p=2*10**n
a=p//3; p+=a
i=2
while a>0:
a=a*i//(i*2+1); i+=1
p+=a
print ("PI=",p//10000)
2020年01月17日 16点01分 1
level 2
idealguy 楼主
轻松获取1万位的圆周率值
2020年01月17日 16点01分 2
1