Created
February 28, 2015 17:22
-
-
Save christianp/2db3938c8c2427810819 to your computer and use it in GitHub Desktop.
Smallest integer-radius sphere whose volume is within 0.0001 of an integer - https://twitter.com/wacnt/status/571459946644029440
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import count | |
from mpmath import pi,floor,ceil,mp | |
for r in count(1): | |
v = pi*mp.mpf(r)**3 * 4/3 | |
d = min(v-floor(v), ceil(v)-v) | |
if d<0.00001: | |
print(r) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output is 12352