Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import math
- lowest_value=1
- for number in range(100, 10001):
- lower_limit = int(number // 3.2)
- upper_limit = int(number // 3.1 + 1)
- for divisor in range(lower_limit, upper_limit):
- division_result = number / divisor
- subtraction_result = division_result - math.pi
- absolute_value = abs(subtraction_result)
- if absolute_value < lowest_value:
- lowest_value = absolute_value
- print(number, "/", divisor, "=", '{0:.9f}'.format(division_result), end="\n")
- # 100 / 31 = 3.225806452
- # 100 / 32 = 3.125000000
- # 101 / 32 = 3.156250000
- # 104 / 33 = 3.151515152
- # 107 / 34 = 3.147058824
- # 110 / 35 = 3.142857143
- # 179 / 57 = 3.140350877
- # 201 / 64 = 3.140625000
- # 223 / 71 = 3.140845070
- # 245 / 78 = 3.141025641
- # 267 / 85 = 3.141176471
- # 289 / 92 = 3.141304348
- # 311 / 99 = 3.141414141
- # 333 / 106 = 3.141509434
- # 355 / 113 = 3.141592920
Add Comment
Please, Sign In to add comment