# Calculate the number e [duplicate]

From Wikipedia:

The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828, and is the limit of (1 + 1/n)n as n approaches infinity.

## Challenge

Calculate the number e to 15 digits after the decimal point.

This means that your output must start with 2.718281828459045 or equivalent.

Your program can output digits after the required output - these may be accurate or inaccurate, inaccuracy after 15 digits does not disqualify you from the challenge. Your program may also output nothing after the required 15 digits.

This is , shortest implementation in bytes wins.

## Constraints

• You may not use built in constants or hardcode the number.
• Standard loopholes and rules apply.

## Reference Implementation (Ruby)

def e(i)
e = 1.0                        # make it floating point
i.times { |n|                  # loop repeats n times
e += 1.0/(1..n+1).reduce(:*) # factorial - no factorial function
}                              # in the Ruby standard library
return e
end
e(200)                           # Almost certainly will return e


## marked as duplicate by squeamish ossifrage, LegionMammal978, TuxCrafting, Morgan Thrapp, xnor code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 27 '16 at 18:57

• Uh, the built in constant part is a bit unclear, what if I do exp(1)? What about (-1)^(1/i*pi))? – FryAmTheEggman Jul 27 '16 at 18:44
• You mention the lim, but then your reference uses the series sum... – Adám Jul 27 '16 at 18:58
• Sorry, a search didn't find the previous question. – dkudriavtsev Jul 28 '16 at 3:03
• @Adám The quote is copy pasted from Wikipedia. The article also shows the series sum formula. – dkudriavtsev Jul 28 '16 at 3:04
• @FryAmTheEggman Use your common sense. Please don't try getting around the rules. – dkudriavtsev Jul 28 '16 at 3:05

-2 Bytes thanks to @xnor

sum[1/product[1..i]|i<-[0..99]]


Straightforward implementation of the series definition. (I have posted a version of this to Reddit before.)

• You don't need parens around the product. – xnor Jul 27 '16 at 18:50

f 99=0;f n=1+f(n+1)/n;f 0

foldr(\x y->1+y/x)0[1..99]