Created
May 13, 2022 15:07
-
-
Save igorvanloo/f02c4b9ad8b4a0b043fb365cffb5feda to your computer and use it in GitHub Desktop.
p197
This file contains hidden or 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
| def f(x): | |
| return math.floor(pow(2, 30.403243784 - x*x)) * pow(10, -9) | |
| def compute(): | |
| u_0 = -1 | |
| prev_sum = 0 | |
| running = True | |
| while running: | |
| u_n = f(u_0) | |
| u_prev = u_0 | |
| u_0 = u_n | |
| new_sum = u_n + u_prev | |
| if round(new_sum, 10) == round(prev_sum, 10): | |
| running = False | |
| else: | |
| prev_sum = new_sum | |
| return round(new_sum, 9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment