We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- ProjectEuler+
- Project Euler #197: Investigating the behaviour of a recursively defined sequence
- Discussions
Project Euler #197: Investigating the behaviour of a recursively defined sequence
Project Euler #197: Investigating the behaviour of a recursively defined sequence
Sort by
recency
|
20 Discussions
|
Please Login in order to post a comment
This worked for me, it doesn't require 10^12 iterations: My implementation-
The series may not only be converging, but periodic.
This code passes for test0 and fails fro all of others I didn't understand the reason.
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!!!
f(Un)=L when n --->+oo
And we have f(Un)=Un+1 so f(Un)=Un+1=L when n--->+oo
meaning that Un become constant when n is big , so we just need to calculate Un and Un+1 when n =1e5 , but if the error is for example 1e-18 we may need to put n=1e6 or more.