Skip to content

Comment on Functional Programming 101 with Haskellparent

Comments

It's actually [n!e] - 1 where [x] the greatest integer less than or equal to x and e is the base of the natural logarithm. As nbouscal points out, the total number of heads is H=n!(1+1/1!+ 1/(n-1)!). Using the Taylor series for e^x, H = n!e - n!(1/n! + 1/(n+1)! + ...) = n!e - 1 - r, where r = (1/(n+1) + 1/(n+1)(n+2) ...). The remainder term r is easily seen to be less than 1, and H is and integer, so H=[H+r]=[n!e]-1.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.