Python - 191 Bytes
for k in range(2,n):A=[(A[j-1]+A[j+1])*j>>1for j in range(n-k+1)];f*=k
~4x faster version - 206 bytes
for k in range(1,n):
for j in range(-~n/2-k+1):A[j]=j*A[j-1]+A[j+1]*(j+2-n%2)
Input is taken from stdin. Output for n = 5000 takes approximately 14s with the second script (or 60s with the first).
$ echo 1 | python pi-trunc.py
$ echo 2 | python pi-trunc.py
$ echo 3 | python pi-trunc.py
$ echo 4 | python pi-trunc.py
$ echo 5 | python pi-trunc.py
$ echo 50 | python pi-trunc.py
$ echo 500 | python pi-trunc.py
$ echo 5000 | python pi-trunc.py
The formula used is the following:
where An is the nth Alternating Number, which can be formally defined as the number of alternating permutations on a set of size n (see also: A000111). Alternatively, the sequence can be defined as the composition of the Tangent Numbers and Secant Numbers (A2n = Sn, A2n+1 = Tn), more on that later.
The small correction factor cn rapidly converges to 1 as n becomes large, and is given by:
For n = 1, this amounts to evaluating the Leibniz Series. Approximating π as 10½, the number of terms required can be calculated as:
which converges (rounded up) to 17, although smaller values of n require considerably more.
For the calculation of An there are several algorithms, and even an explicit formula, but all of them are quadratic by n. I originally coded an implementation of Seidel's Algorithm, but it turns to be too slow to be practical. Each iteration requires an additional term to be stored, and the terms increase in magnitude very rapidly (the "wrong" kind of O(n2)).
The first script uses an implementation of an algorithm originally given by Knuth and Buckholtz:
Let T1,k = 1 for all k = 1..n
Subsequent values of T are given by the recurrence relation:
Tn+1,k = 1/2 [ (k - 1) Tn,k-1 + (k + 1) Tn,k+1 ]
An is then given by Tn,1
(see also: A185414)
Although not explicitly stated, this algorithm calculates both the Tangent Numbers and the Secant Numbers simultaneously. The second script uses a variation of this algorithm by Brent and Zimmermann, which calculates either T or S, depending on the parity of n. The improvement is quadratic by n/2, hence the ~4x speed improvement.