You are viewing a single comment's thread. Return to all comments →
import math def dp(b, start_val): array = [0]150 array[0] = start_val i=0 while i<=148: array[i+1] = math.floor(2*(b-array[i]2)) * 10(-9) if(array[i+1] == array[i]): break i+=1
print (array[i] + array[i-1])
ub = input().split() u0 = float(ub[0]) b = float(ub[1]) start_val = math.floor(2**(b-u0**2)) * 10**(-9) dp(b, start_val)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #197: Investigating the behaviour of a recursively defined sequence
You are viewing a single comment's thread. Return to all comments →
import math def dp(b, start_val): array = [0]150 array[0] = start_val i=0 while i<=148: array[i+1] = math.floor(2*(b-array[i]2)) * 10(-9) if(array[i+1] == array[i]): break i+=1
ub = input().split() u0 = float(ub[0]) b = float(ub[1]) start_val = math.floor(2**(b-u0**2)) * 10**(-9) dp(b, start_val)
passed all test cases. Cheers!!!