RosettaCodeData/Task/Pi/11l/pi.11l

32 lines
564 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
V ndigits = 0
V q = BigInt(1)
V r = BigInt(0)
V t = q
V k = q
V n = BigInt(3)
V l = n
V first = 1B
L ndigits < 1'000
I 4 * q + r - t < n * t
print(n, end' )
ndigits++
I ndigits % 70 == 0
print()
I first
first = 0B
print(., end' )
V nr = 10 * (r - n * t)
n = ((10 * (3 * q + r)) I/ t) - 10 * n
q *= 10
r = nr
E
V nr = (2 * q + r) * l
V nn = (q * (7 * k + 2) + r * l) I/ (t * l)
q *= k
t *= l
l += 2
k++
n = nn
r = nr