Problem 56000. Estimating Euler's (Oi-ler-z) Number
Euler's number is an irrational constant given by ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM8AAAAkCAYAAAAuAm4eAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAz6ADAAQAAAABAAAAJAAAAABW7WsAAAAIhElEQVR4Ae2Ze6hVRRTG7WFeszSrW4nhKzUzUKlMzdLSil7Qw7SUTCVCov6wQJKKbmVYImjSE5JQsyCJLDHKtIf2MhUt7aKVJlmWvTQzH5llv++2R+eOc/bZ+5x9z7nXZsF3ZmatNWvttfbseZ1GjQKFDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAxkk4HDsjFT762cxhOeB7qBCvAJ+BisB4XQcXTqlKLjKnT/jNE/HNkwoGebFqNni3rQUEwdQTOgWBaCFSCOGiO8CCgXncEGoFwsBTtBPirUr223lPHafkM9RQY0UKrAHrDPg+nwjgBp6TE6+Ozl4rXJ4UCD6EawJrI3K4eezZatuZH+15QvgnlgR8SbTam4fdQd5qfA95y/wu/l6xTxivFrzJY6XuM3lAVk4Fn6+AaKzZuDzlEpbDdFd2sCu8bHlx7bWvEHgdWOnXwfzzHoaxWT7aeA/ZFodd0QyZ6ndKkTDK0s5rl85XbkA9yOtIvxK3PliNcTRmAlzcAlKGqAfA4GAm2JWoBLgRmAZgBdBS8pjUJR/ZaBMWA4uMkDDUTpPQpcugLGq0D9zCoi3Xwfz1h0pLcN+D74GyK5dFoBQxq8i8Hf4BEgmVZcfXBq2yvzctouFerX2Cl1vMZvKAvMwHz6fQdO9vTX6rEOaJAJU0BS0nnpLeAbvMZGJZW9QLZ7GmaO8vpIT7r5Ph59cNKrBj5qB1NyYQgw1IeKePcZhlPeGsmlow+spSMv1K9jpqZZinh9fjPnaQ96KJK2GRcCzZg/Apd2wXjQYva36nFVrV5/gBFAs3UuuhaBZvaNQ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+W+bdP2bBH4BXQtJpCYvlqRlTsN4DSUZjB9j2H5WJ7DQbtILp0dOXTE1i2qJsWn1UhAWfmVq3LEmyDE4lW0hzYfz/vFm9tvoa9l19gvpFyy32LySmNUXwe/g54x3UYiOzdGHieyt2zXxSl6ZGkGk9myxV3UVONDud3u8SXWQLAb6CPXZYOPWsJ82BJk4deYK3W8xm/mpW6GbFKSDLUwFafUYBwHdCje5MhyNfVCy3HbpsExCwwAl4NlwEfajj4DdFNlSDdY6rcBrDPMHKVmcuVS+dMKlIbSrOq6CNAznR7j4FtkWl3XenR6w9MWTB/fCPAPcEnvdzqwx0Kxfm0fpYxXZ9xuYCHQVtemfO83rq9tp1ZdydfMpcReUEvy30XBh/DeBjpD1GfSS5oGFIu2HdM9mAlvJfgbLAY2abUyeehhCzz1NyLdlz2yfKyRUV/5ytd/nKU7hLpLuhHdAmRrvCPUIDKyl6hP92AuPF2zq78+UkPF+DU2TDmSiuzXdbx98LE38jOH0qW495uvr2trf3sKNROcZp+p4B6gxO4CM0BjUN9pMg9o4khSurdXmjxMvwkxwR6PTLOadIfG6PlEHWB+Bowf/XcWt6ochXxepK9BPggY0kz5DpAtnYmka6gzlc3A+MlXrkPXXiEK9Wv8m7JU8crfRGDi1ORYIWZEup2Me79xfY0Nb6mk3Q/k0DhX+Q24EzQESnvG2kpQTZ3AtFVR3Jq9+jsyuzmKhvR2g2NtQUy9NTKt8PYLlA1BvA1gNPBRE5hPgh1A+vq/R4Ndz6lnmARaApsW0DD2k5RaaVwqxK+xUep45VdnK5Nfxe9S3PvN17fGlj27uMYV8JlAe8ONYA3Qw/xf6GgC7QdWg00xQbdF1gZoMK+I0ctapP/fzgLy/xf4CqwF20BdUkPyewaJaAXeA+7Yzfd+4/piLlDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEDIQMhAyEBDzcC/6dWkHPTyg8IAAAAASUVORK5CYII=)
Starting with x=0, count the number of times you can add a uniformly distributed random number to x before it equals or exceeds 1. Repeat this N times, then calculate the estimate of Euler's number by computing the mean of those counts.
The more iterations calcualted, the closer the approximation should be.
The input to your function should be the number of iterations of the algorithm to perform (N) and the output should be the estimate of Euler's number.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers76
Suggested Problems
-
Return elements unique to either input
763 Solvers
-
How long do each of the stages of the rocket take to burn?
286 Solvers
-
508 Solvers
-
Simpson's Paradox - Calculate correlation coefficients for groups of data
183 Solvers
-
Find the minimum of the column-maximums of a matrix
308 Solvers
More from this Author12
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!