Charcoal, 23 bytes
≔⁰θF⊖φ≔÷⁺Xχ⁴⁹⁹θ⁻φιθ2.Iθ
Try it online! Link is to verbose version of code. Explanation:
≔⁰θ
Start with a running total of 0
.
F⊖φ≔÷⁺Xχ⁴⁹⁹θ⁻φιθ
For each integer from 1000
down to 2
, add 10**499
to the running total, then divide by that integer. This is equivalent to summing the reciprocals of the factorials from 2
to 1000
but without any loss of precision.
2.Iθ
Output e
to 500
digits.
20 bytes to output without the decimal point:
≔⁰θFφ≔⁺Xχ⁴⁹⁹÷θ⁻φιθIθ
Try it online! Link is to verbose version of code. Explanation: As above but counts down to 1
and also adds the 10**499
after dividing so that the result includes the 0!
and 1!
terms.