Almkvist-Giullera formula for pi: Difference between revisions

Added 11l
(Added Quackery.)
(Added 11l)
Line 30:
:* &nbsp;[https://arxiv.org/pdf/1009.5202.pdf Gert Almkvist and Jesús Guillera, Ramanujan-like series for 1/π<sup>2</sup> and string theory, Experimental Mathematics, 21 (2012), page 2, formula 1].
<br><br>
 
=={{header|11l}}==
{{trans|С#}}
 
<lang 11l>F isqrt(BigInt =x)
BigInt q = 1
BigInt r = 0
BigInt t
L q <= x
q *= 4
L q > 1
q I/= 4
t = x - r - q
r I/= 2
I t >= 0
x = t
r += q
R r
 
F dump(=digs, show)
V gb = 1
digs++
V dg = digs + gb
BigInt t1 = 1
BigInt t2 = 9
BigInt t3 = 1
BigInt te
BigInt su = 0
V t = BigInt(10) ^ (I dg <= 60 {0} E dg - 60)
BigInt d = -1
BigInt _fn_ = 1
 
V n = 0
L n < dg
I n > 0
t3 *= BigInt(n) ^ 6
te = t1 * t2 I/ t3
V z = dg - 1 - n * 6
I z > 0
te *= BigInt(10) ^ z
E
te I/= BigInt(10) ^ -z
I show & n < 10
print(‘#2 #62’.format(n, te * 32 I/ 3 I/ t))
su += te
 
I te < 10
I show
digs--
print("\n#. iterations required for #. digits after the decimal point.\n".format(n, digs))
L.break
 
L(j) n * 6 + 1 .. n * 6 + 6
t1 *= j
d += 2
t2 += 126 + 532 * d
 
n++
 
V s = String(isqrt(BigInt(10) ^ (dg * 2 + 3) I/ su I/ 32 * 3 * BigInt(10) ^ (dg + 5)))
R s[0]‘.’s[1 .+ digs]
 
print(dump(70, 1B))</lang>
 
{{out}}
<pre>
0 9600000000000000000000000000000000000000000000000000000000000
1 512256000000000000000000000000000000000000000000000000000000
2 19072247040000000000000000000000000000000000000000000000000
3 757482485760000000000000000000000000000000000000000000000
4 31254615037245600000000000000000000000000000000000000000
5 1320787470322549142065152000000000000000000000000000000
6 56727391979308908329225994240000000000000000000000000
7 2465060024817298714011276371558400000000000000000000
8 108065785435463945367040747443956640000000000000000
9 4770177939159496628747057049083997888000000000000
 
53 iterations required for 70 digits after the decimal point.
 
3.1415926535897932384626433832795028841971693993751058209749445923078164
</pre>
 
=={{header|C#|Csharp}}==
1,480

edits