Skip to content

Instantly share code, notes, and snippets.

@axiomsofchoice
Last active June 15, 2016 14:48
Show Gist options
  • Save axiomsofchoice/a3e75cc7ea3516182a93fd611a6e5e6b to your computer and use it in GitHub Desktop.
Save axiomsofchoice/a3e75cc7ea3516182a93fd611a6e5e6b to your computer and use it in GitHub Desktop.
How to estimate the number e on a checkerboard
# via https://twitter.com/JohnAllenPaulos/status/743085219511554049
import string
import random
print 64.0 / float(string.count(bin(reduce(lambda x,y: x | (1L<<y), [random.randint(1,64) for _ in range(64)])), '0') - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment