Talk:Popular problem
Jump to navigation
Jump to search
It might be nice to have a list of languages in which the more difficult problems (e.g. quine) have been solved. Adding a category might be too much, though... any thoughts? --Graue 16:03, 12 Jun 2005 (GMT)
- Why not make that a sub section of the Quine article. This should also include links to the programs. --Rune 16:16, 12 Jun 2005 (GMT)
Pie calculator
I found some good Python programs that can work out the digits of pie.
# A new way to calculate pie a4=1 num=1 denom=1 for i in range(1,5000): a2=1 a3=0 for a1 in range(i,-1,-2): a3=a3+a2 a2=-a2*a1*(a1-1) # layer 2 ends a4=a4+a3 num=num*(i+1) denom=denom*(i+1) num=num+a4 pie=4*num/denom print(i,' ',pie) # layer 1 ends
num=1
denom=1
for i in range(2,500,1):
a1=1
a3=1
a5=0
for a1 in range(1,i+1,2):
a2=1
b1=1
b2=i
for b1 in range(1,a1+1,1):
a2*=b2
a2=a2//b1
b2-=1
a3*=(a1-2)*(a1-2)
a5+=a2*a3
num=num*i+a5
denom*=i
print(i,' ',2*num/denom)
a1=1
Happy pie day!