Created
July 21, 2020 00:51
-
-
Save smunkel/a65e6d9fd181f0b935df900fd6a43294 to your computer and use it in GitHub Desktop.
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 math import gcd, sqrt | |
import random | |
def area(radius): | |
c = 0 | |
for total in range(4_631_219): | |
a = random.randint(1, 666) | |
b = random.randint(1, 666) | |
if gcd(a, b) == 1: | |
c += 1 | |
return sqrt(6 * total / c * (radius ** 4)) | |
if __name__ == "__main__": | |
while True: | |
radius = input("circle's radius: ") | |
try: | |
radius = float(radius) | |
break | |
except ValueError: | |
continue | |
print(area(radius)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment