Skip to content

Instantly share code, notes, and snippets.

@livibetter
Forked from bradmontgomery/paper.py
Last active December 27, 2015 08:49
Show Gist options
  • Save livibetter/7299784 to your computer and use it in GitHub Desktop.
Save livibetter/7299784 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
Folding paper in half 50 times is 3/4 of the distance from earth to sun
From:
http://www.quora.com/What-are-some-of-the-most-mind-blowing-facts#answer_526501
Thickness of a sheet of paper: 0.1 mm (~0.004 inches)
"""
AU = 149597870700
def fold(num_folds=50, thickness=1E-4):
"""Simulate folding a sheet of paper in half.
``num_folds`` is the number of times we'll fold the paper in half.
``thickness`` is the the thickness of a sheet of paper in meters.
"""
for i in range(1, num_folds + 1):
thickness *= 2
fmt_string = '{n:2} folds, thickness = {thickness:E} m = {au:f} AU'
print(fmt_string.format(n=i, thickness=thickness, au=thickness / AU))
def main():
n = int(input("How many folds? "))
fold(n)
if __name__ == "__main__":
main()
@livibetter
Copy link
Author

Will the piece of paper (or should I say block of paper) burn? And it can be heavier than Mercury. I am thinking too much to this 50-fold paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment