Husk, 28 25 24 bytes
i*!500İ⁰ΣG*2mṠ/o!İ1→ḣ□70
Try it online!
Calculates the value of pi as a rational number using the first 5000 terms of the infinite series 2 + 1/3*(2 + 2/5*(2 + 3/7*(2 + 4/9*(2 + ...))))
, and then extracts the first 500 digits.
The code to calculate the value of pi from a specified number of terms is only 13 bytes (ΣG*2mṠ/o!İ1→ḣ
):
ΣG*2mṠ/o!İ1→ḣ
Σ # the sum of
G*2 # the cumulative product, starting at 2, of
m # mapping the following function to all terms of
ḣ # series from 1 to ... (whatever number is specified)
Ṡ/ # divide by x
o! → # element at index -1
İ1 # of series of odd numbers
Unfortunately, we then need to waste 3 bytes specifying the number of terms to use:
□70 # 70^2 = 4900
And then 8 more bytes converting the rational number (expressed as a fraction) into its digits in decimal form:
i*!500İ⁰
i # integer value of
* # multiplying by
!500 # 500th element of
İ⁰ # series of powers of 10