# Approximate the Fransén-Robinson constant

Given an input n, output the value of the Fransén-Robinson constant with n digits after the decimal place, with rounding.

# Rules

• You may assume that all inputs are integers between 1 and 60.
• You may not store any related values - the constant must be calculated, not recalled.
• Rounding must be done with the following criteria:
• If the digit following the final digit is less than five, the final digit must remain the same.
• If the digit following the final digit is greater than or equal to five, the final digit must be incremented by one.
• You must only output the first n+1 digits.
• Standard loopholes apply.

# Test Cases

>>> f(0)
3

>>> f(1)
2.8

>>> f(11)
2.80777024203

>>> f(50)
2.80777024202851936522150118655777293230808592093020

>>> f(59)
2.80777024202851936522150118655777293230808592093019829122005

>>> f(60)
2.807770242028519365221501186557772932308085920930198291220055

• What if you do not have support for arbitrary precision floats? May 27, 2016 at 22:10
• @flawr I suppose that the language would have to use some form of string concatenation or similar. Otherwise, it may not be the language for this challenge. May 27, 2016 at 22:11
• Too bad, that basically only leaves us with hardcoding the numbers. PS: Why don't you add f(60) to the test cases? That way participants wouldn't have to fetch it externally=) May 27, 2016 at 22:14
• @flawr Hardcoding is disallowed by rule 2. May 27, 2016 at 22:15
• Are trailing zeroes ok?
– user45941
May 27, 2016 at 23:41

## Mathematica, 443936 25 UTF-8 bytes

• -5 bytes thanks to Sp3000
• -3 bytes thanks to kennytm
• -11 bytes thanks to senegrom

Crossed out 44 is still regular 44!!

N[∫1/x!{x,-1,∞},#+1]&


Example:

f=N[∫1/x!{x,-1,∞},#+1]&
f[2]


Outputs 2.81.

Explanation

N[               , # + 1]
∫1/x!{x,-1,∞}


First step takes Numeric of the rest, with # (first parameter) + 1 precision. ! (factorial) does what you'd expect. {x, -1, Infinity} sets the bounds for the (strangely formatted) Integral.

• I can't test this, so I assume this rounds correctly? May 27, 2016 at 23:03
• @VTCAKAVSMoACE I checked for n = 60, it rounds correctly. (The 61st digit is an 8). You can look at Wolfram's docs for N. May 27, 2016 at 23:04
• Coolio. Just checking. May 27, 2016 at 23:04
• You can probably use a literal ∞ in place of Infinity. I'd suggest dividing by 0, if that didn't produce ComplexInfinity instead... May 28, 2016 at 4:44
• try N[∫1/x!{x,-1,∞},#+1]& where  is Unicode-F74C; displays as 𝕕 in Mathematica. (note that the space before & is also not necessary...) Jun 2, 2016 at 11:19