A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
10
Task/Pi/Groovy/pi.groovy
Normal file
10
Task/Pi/Groovy/pi.groovy
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
BigInteger q = 1, r = 0, t = 1, k = 1, n = 3, l = 3
|
||||
String nn
|
||||
boolean first = true
|
||||
|
||||
while (true) {
|
||||
(nn, first, q, r, t, k, n, l) = (4*q + r - t < n*t) \
|
||||
? ["${n}${first?'.':''}", false, 10*q, 10*(r - n*t), t , k , 10*(3*q + r)/t - 10*n , l ] \
|
||||
: ['' , first, q*k , (2*q + r)*l , t*l, k + 1, (q*(7*k + 2) + r*l)/(t*l), l + 2]
|
||||
print nn
|
||||
}
|
||||
28
Task/Pi/Icon/pi.icon
Normal file
28
Task/Pi/Icon/pi.icon
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
procedure pi (q, r, t, k, n, l)
|
||||
first := "yes"
|
||||
repeat { # infinite loop
|
||||
if (4*q+r-t < n*t) then {
|
||||
suspend n
|
||||
if (\first) := &null then suspend "."
|
||||
# compute and update variables for next cycle
|
||||
nr := 10*(r-n*t)
|
||||
n := ((10*(3*q+r)) / t) - 10*n
|
||||
q *:= 10
|
||||
r := nr
|
||||
} else {
|
||||
# compute and update variables for next cycle
|
||||
nr := (2*q+r)*l
|
||||
nn := (q*(7*k+2)+r*l) / (t*l)
|
||||
q *:= k
|
||||
t *:= l
|
||||
l +:= 2
|
||||
k +:= 1
|
||||
n := nn
|
||||
r := nr
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
procedure main ()
|
||||
every (writes (pi (1,0,1,1,3,3)))
|
||||
end
|
||||
6
Task/Pi/J/pi-1.j
Normal file
6
Task/Pi/J/pi-1.j
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
pi=:3 :0
|
||||
smoutput"0'3.1'
|
||||
n=.0 while.n=.n+1 do.
|
||||
smoutput-/1 10*<.@o.10x^1 0+n
|
||||
end.
|
||||
)
|
||||
13
Task/Pi/J/pi-2.j
Normal file
13
Task/Pi/J/pi-2.j
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
pi''
|
||||
3
|
||||
.
|
||||
1
|
||||
4
|
||||
1
|
||||
5
|
||||
9
|
||||
2
|
||||
6
|
||||
5
|
||||
3
|
||||
...
|
||||
35
Task/Pi/Liberty-BASIC/pi.liberty
Normal file
35
Task/Pi/Liberty-BASIC/pi.liberty
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
ndigits = 0
|
||||
|
||||
q = 1
|
||||
r = 0
|
||||
t = q
|
||||
k = q
|
||||
n = 3
|
||||
L = n
|
||||
|
||||
first = 666 ' ANY non-zero =='true' in LB.
|
||||
|
||||
while ndigits <100
|
||||
if ( 4 *q +r -t) <( n *t) then
|
||||
print n;
|
||||
ndigits =ndigits +1
|
||||
if not( ndigits mod 40) then print: print " ";
|
||||
if first =666 then first = 0: print ".";
|
||||
nr =10 *( r -n *t)
|
||||
n =int( ( (10 *( 3 *q +r)) /t) -10 *n)
|
||||
q =q *10
|
||||
r =nr
|
||||
else
|
||||
nr =( 2 *q +r) *L
|
||||
nn =(q *( 7 *k +2) +r *L) /( t *L)
|
||||
q =q *k
|
||||
t =t *L
|
||||
L =L +2
|
||||
k =k +1
|
||||
n =int( nn)
|
||||
r =nr
|
||||
end if
|
||||
scan
|
||||
wend
|
||||
|
||||
end
|
||||
1
Task/Pi/Mathematica/pi.mathematica
Normal file
1
Task/Pi/Mathematica/pi.mathematica
Normal file
|
|
@ -0,0 +1 @@
|
|||
N[Pi, 1000000!]
|
||||
Loading…
Add table
Add a link
Reference in a new issue