Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Created May 13, 2022 15:07
Show Gist options
  • Select an option

  • Save igorvanloo/f02c4b9ad8b4a0b043fb365cffb5feda to your computer and use it in GitHub Desktop.

Select an option

Save igorvanloo/f02c4b9ad8b4a0b043fb365cffb5feda to your computer and use it in GitHub Desktop.
p197
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